コード例 #1
0
 def test_a_models_and_utils(self):
     """
     test OneHundredReport model
     """
     logging.info('\nStart model test..')
     inst = OneHundredReport(**self._data)
     DB.add(inst)
     res = DB.query(OneHundredReport).all()
     model = res.pop()
     self.assertEqual(str(model), '1_1_2010-05-01')
     self.assertDictEqual(model_to_dict(model), \
         {'REGN': 1, 'PLAN': 'А', 'NUM_SC': '10207', 'A_P': '2', 'VR': 23064358, 'VV':\
         0, 'VITG': 23064358.0, 'ORA': 0, 'OVA': 0, 'OITGA': 0.0, 'ORP': 0, 'OVP': 0,\
         'OITGP': 0.0, 'IR': 23064358, 'IV': 0, 'IITG': 23064358.0, 'DT':\
         '2010-05-01', 'PRIZ': 1, 'P_K':1})
コード例 #2
0
 def test_one_hundred_report_endpoint(self):
     """
     test for one_hundred_report
     """
     logging.info('\nStart endpoint test..')
     DB.add(OneHundredReport(**self._data))
     resp = json.loads(self._client.get('/one_hundred_report/1').\
         get_data().decode())
     self.assertListEqual(
         [{'A_P': '2', 'DT': '2010-05-01T00:00:00', 'IITG': 23064358, 'IR':\
         23064358.0, 'IV': 0.0, 'NUM_SC': '10207', 'OITGA': 0.0, 'OITGP': 0.0, 'ORA':\
         0.0, 'ORP': 0.0, 'OVA': 0.0, 'OVP': 0.0, 'PLAN': 'А', 'PRIZ': 1, 'P_K': 1,\
         'REGN': 1, 'VITG': 23064358.0, 'VR': 23064358.0, 'VV': 0.0}, {'A_P': '2', 'DT':\
         '2010-05-01T00:00:00', 'IITG': 23064358, 'IR': 23064358.0, 'IV': 0.0, 'NUM_SC':\
         '10207', 'OITGA': 0.0, 'OITGP': 0.0, 'ORA': 0.0, 'ORP': 0.0, 'OVA': 0.0, 'OVP':\
         0.0, 'PLAN': 'А', 'PRIZ': 1, 'P_K': 2, 'REGN': 1, 'VITG': 23064358.0, 'VR':
         23064358.0, 'VV': 0.0}], resp)