<s> from django . test import TestCase <EOL> from . . models import Story , StoryCategory <EOL> class StoryModelTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . category = StoryCategory . objects . create ( name = '<STR_LIT>' ) <EOL> self . story1 = Story . objects . create ( <EOL> name = '<STR_LIT>' , <EOL> company_name = '<STR_LIT>' , <EOL> company_url = '<STR_LIT>' , <EOL> category = self . category , <EOL> content = '<STR_LIT>' , <EOL> is_published = True ) <EOL> self . story2 = Story . objects . create ( <EOL> name = '<STR_LIT>' , <EOL> company_name = '<STR_LIT>' , <EOL> company_url = '<STR_LIT>' , <EOL> category = self . category , <EOL> content = '<STR_LIT>' , <EOL> is_published = False ) <EOL> self . story3 = Story . objects . create ( <EOL> name = '<STR_LIT>' , <EOL> company_name = '<STR_LIT>' , <EOL> company_url = '<STR_LIT>' , <EOL> category = self . category , <EOL> content = '<STR_LIT>' , <EOL> is_published = True , <EOL> featured = True , <EOL> weight = <NUM_LIT:10> , <EOL> ) <EOL> def test_published ( self ) : <EOL> self . assertQuerysetEqual ( Story . objects . published ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_draft ( self ) : <EOL> self . assertQuerysetEqual ( Story . objects . draft ( ) , [ '<STR_LIT>' ] ) <EOL> def test_featured ( self ) : <EOL> self . assertQuerysetEqual ( Story . objects . featured ( ) , [ '<STR_LIT>' ] ) <EOL> def test_featured_weight_total ( self ) : <EOL> self . assertEqual ( Story . objects . featured_weight_total ( ) , <NUM_LIT:10> ) <EOL> Story . objects . create ( <EOL> name = '<STR_LIT>' , <EOL> company_name = '<STR_LIT>' , <EOL> company_url = '<STR_LIT>' , <EOL> category = self . category , <EOL> content = '<STR_LIT>' , <EOL> is_published = True , <EOL> featured = True , <EOL> weight = <NUM_LIT> , <EOL> ) <EOL> self . assertEqual ( Story . objects . featured_weight_total ( ) , <NUM_LIT:32> ) </s>
