Ejemplo n.º 1
0
 def test_combination_primarykey(self):
     factories.AuditCaseFactory()
     results = self._results(
         api.url_for(AuditCaseView,
                     audit_case_id='2219',
                     primary_category_id='3',
                     sub_category_id='227'))
     assert len(results) == 1
     assert results[0].keys() == AuditCaseSchema().fields.keys()
Ejemplo n.º 2
0
 def test_multi_column(self):
     audit = [
         factories.AuditCaseFactory(
             cycle=2012,
             committee_name='Boy',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2012,
             committee_name='Girl',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2012,
             committee_name='Ted',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2012,
             committee_name='Zoo',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2014,
             committee_name='Abc',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2014,
             committee_name='John',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
         factories.AuditCaseFactory(
             cycle=2014,
             committee_name='Ted',
             primary_category_id=-1,
             sub_category_id=-2,
             audit_case_id=1000,
         ),
     ]
     query, columns = sorting.multi_sort(models.AuditCase.query, [
         'cycle',
         'committee_name',
     ],
                                         model=models.AuditCase)
     self.assertEqual(query.all(), audit)