Esempio n. 1
0
 def test_to_dict(self):
     s = DataServiceInfo(**self.TESTDATA)
     self.assertEqual(s.to_dict(), self.TESTDATA,
                      'dict representation matches constructed data')
     s.last_hb_time = time.time()
     self.assertEqual(s.to_dict(), self.TESTDATA,
                      'dict representation ignores last_hb_time')
Esempio n. 2
0
 def test_to_json(self):
     s = DataServiceInfo(**self.TESTDATA)
     self.assertEqual(json.loads(s.to_json()), self.TESTDATA,
                      'JSON representation matches constructed data')
     s.last_hb_time = time.time()
     self.assertEqual(json.loads(s.to_json()), self.TESTDATA,
                      'JSON representation ignores last_hb_time')