Example #1
0
 def test_assess_column_status_missing(self):
     ''' Tests if the missing column status is returned correctly when
         the column exists in the list but not in the collection from REDIS '''
     self.assertEqual(
         Empresa.assess_column_status(self.SLOT_LIST, self.KEY_COLLECTION, '2047'),
         'MISSING'
     )
Example #2
0
 def test_assess_column_status_unavailable(self):
     ''' Tests if the unavailable column status is returned correctly
         when a data that is not present both in the dictionary of
         available data and the REDIS collection '''
     self.assertEqual(
         Empresa.assess_column_status(self.SLOT_LIST, self.KEY_COLLECTION, '1500'),
         'UNAVAILABLE'
     )
Example #3
0
 def test_assess_column_status_deprecated(self):
     ''' Tests if the deprecated data status is returned correctly when
         the column exists in the collection from REDIS but not in the
         dictionary of data present in datalake '''
     self.assertEqual(
         Empresa.assess_column_status(self.SLOT_LIST, self.KEY_COLLECTION, '2099'),
         'DEPRECATED'
     )
Example #4
0
 def test_build_empty_stats_no_aggr(self):
     ''' Tests if a 0 total object is created according to given options with
         no aggregations '''
     self.assertEqual(
         Empresa.build_empty_stats(
             {},
             {"cnpj_raiz": "col_cnpj_raiz"},
             {"cnpj_raiz": "12345678"}
         ),
         {"col_cnpj_raiz": "12345678"}
     )
Example #5
0
 def test_build_empty_stats_val_aggr(self):
     ''' Tests if a 0 total object is created according to given options with
         aggregations and values '''
     self.assertEqual(
         Empresa.build_empty_stats(
             {"agregacao": ['sum', 'count'], "valor": ['vl_a', 'vl_b']},
             {"cnpj_raiz": "col_cnpj_raiz"},
             {"cnpj_raiz": "12345678"}
         ),
         {
             "col_cnpj_raiz": "12345678",
             "agr_sum_vl_a": 0, "agr_count_vl_a": 0,
             "agr_sum_vl_b": 0, "agr_count_vl_b": 0
         }
     )
Example #6
0
 def set_domain(self):
     ''' Domain setter, called from constructor '''
     self.domain = Empresa()
Example #7
0
 def test_assess_column_status_existing(self):
     ''' Tests if the existing column status is returned correctly '''
     self.assertEqual(
         Empresa.assess_column_status(self.SLOT_LIST, self.KEY_COLLECTION, '2019'),
         'INGESTED'
     )