示例#1
0
    def test_toJSON(self):
        """Tests the JSON serialization method."""
        TEST_MSG = 'Hello, world.'
        TEST_TIME = datetime.datetime.now()

        server_info = ServerInfo()
        server_info.timestamp = TEST_TIME
        server_info.team_msg = TEST_MSG
        json_data = server_info.toJSON()

        self.assertTrue('message' in json_data)
        self.assertEqual(json_data['message'], TEST_MSG)
        self.assertTrue('message_timestamp' in json_data)
        self.assertEqual(json_data['message_timestamp'], str(TEST_TIME))
示例#2
0
    def test_toJSON(self):
        """Tests the JSON serialization method."""
        TEST_MSG = 'Hello, world.'
        TEST_TIME = datetime.datetime.now()

        server_info = ServerInfo()
        server_info.timestamp = TEST_TIME
        server_info.team_msg = TEST_MSG
        json_data = server_info.toJSON()

        self.assertTrue('message' in json_data)
        self.assertEqual(json_data['message'], TEST_MSG)
        self.assertTrue('message_timestamp' in json_data)
        self.assertEqual(json_data['message_timestamp'], str(TEST_TIME))