コード例 #1
0
ファイル: test_data_service.py プロジェクト: MustWin/congress
 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')
コード例 #2
0
ファイル: test_data_service.py プロジェクト: MustWin/congress
 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')