def setUp(self): self.client = app.test_client() self.category = create_category() self.subcategory = create_subcategory(self.category.id) self.state1_code = 'NY' self.state2_code = 'AZ' create_state(code=self.state1_code) create_state(code=self.state2_code)
def setUp(self): self.state_code = 'NY' create_state(code=self.state_code) self.category = create_category() self.subcategory = create_subcategory(self.category.id) self.link = Link( subcategory_id=self.subcategory.id, state=self.state_code, text='Section 20 of Statute 39-B', url='ny.gov/link/to/statute', ).save()
def setUp(self): self.state = create_state() self.category = create_category() self.grade = StateCategoryGrade( state_code=self.state.code, category_id=self.category.id, grade=2, ).save()
def setUp(self): self.client = app.test_client() self.state = create_state() category = create_category() create_state_grade(self.state.code) create_state_grade(self.state.code) create_state_category_grade(self.state.code, category.id) create_state_category_grade(self.state.code, category.id)
def setUp(self): self.state = create_state() self.category = create_category() self.subcategory = create_subcategory(self.category.id) self.criterion = create_criterion(self.subcategory.id) self.score = Score( criterion_id=self.criterion.id, state=self.state.code, meets_criterion=True, ).save()
def test_serialize_no_grades(self): state = create_state(code='AK') self.assertEqual( { 'code': state.code, 'name': state.name, 'innovative_idea': state.innovative_idea, 'honorable_mention': state.honorable_mention, 'grade': None, 'category_grades': [], 'criterion_scores': [], 'links': [], }, state.serialize())
def setUp(self): self.client = app.test_client() self.state = State( code='NY', name='New York', innovative_idea='Innovative idea', honorable_mention='Honorable mention', ).save() other_state = create_state(code='AZ') category1 = create_category() category2 = create_category() subcategory = create_subcategory(category1.id) criterion1 = create_criterion(subcategory.id) criterion2 = create_criterion(subcategory.id) self.link1 = create_link(subcategory.id, self.state.code) self.link2 = create_link(subcategory.id, self.state.code) self.state_grade1 = create_state_grade(self.state.code) self.state_grade2 = create_state_grade(self.state.code) # state_grade1 is more recent than state_grade2 self.state_grade1.created_at = datetime.utcnow() self.state_grade2.created_at = datetime.utcnow() - timedelta(5) self.state_category_grade1 = create_state_category_grade( self.state.code, category1.id) self.state_category_grade2 = create_state_category_grade( self.state.code, category1.id) self.state_category_grade3 = create_state_category_grade( self.state.code, category2.id) # state_category_grade1 is more recent than state_category_grade2 self.state_category_grade1.created_at = datetime.utcnow() self.state_category_grade2.created_at = datetime.utcnow() - timedelta( 5) self.score1 = Score( criterion_id=criterion1.id, state=self.state.code, meets_criterion=True, ) self.score2 = Score( criterion_id=criterion2.id, state=self.state.code, meets_criterion=False, ) self.score3 = Score( criterion_id=criterion2.id, state=self.state.code, meets_criterion=True, ) # score2 is more recent than score3 self.score3.created_at = datetime.utcnow() - timedelta(5) self.score4 = Score( criterion_id=criterion2.id, state=other_state.code, meets_criterion=True, ) Score.save_all([self.score1, self.score2, self.score3, self.score4]) self.maxDiff = None
def setUp(self): self.state = create_state() self.grade = StateGrade( state_code=self.state.code, grade=2, ).save()
def setUp(self): self.client = app.test_client() self.category = create_category() self.subcategory = create_subcategory(self.category.id) self.criterion = create_criterion(self.subcategory.id) self.state = create_state()