コード例 #1
0
    def test_default_dict(self):
        command_name = 'test'

        cmd = WsCommand.create({'id': 1, 'command': command_name, })
        result = cmd.to_dict()

        self.assertDictEqual({'command': command_name, 'parameters': [], }, result)
コード例 #2
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_timestamp_can_be_set(self):
     expected_timestamp = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'timestamp': expected_timestamp,
     })
     self.assertEqual(expected_timestamp, cmd.timestamp)
コード例 #3
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_lifetime_can_be_set(self):
     expected_lifetime = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'lifetime': expected_lifetime,
     })
     self.assertEqual(expected_lifetime, cmd.lifetime)
コード例 #4
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_user_id_can_be_set(self):
     expected_user_id = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'userId': expected_user_id,
     })
     self.assertEqual(expected_user_id, cmd.user_id)
コード例 #5
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_flags_can_be_set(self):
     expected_flags = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'flags': expected_flags,
     })
     self.assertEqual(expected_flags, cmd.flags)
コード例 #6
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_status_can_be_set(self):
     expected_status = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'status': expected_status,
     })
     self.assertEqual(expected_status, cmd.status)
コード例 #7
0
 def test_default_values_of_attributes(self):
     cmd = WsCommand.create({'id': 1, 'command': 'test', })
     self.assertIsNone(cmd.timestamp)
     self.assertIsNone(cmd.user_id)
     self.assertIsNone(cmd.lifetime)
     self.assertIsNone(cmd.flags)
     self.assertIsNone(cmd.status)
     self.assertIsNone(cmd.result)
コード例 #8
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_result_can_be_set(self):
     expected_result = 1
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'result': expected_result,
     })
     self.assertEqual(expected_result, cmd.result)
コード例 #9
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_parameters_defaults_to_tuple(self):
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
     })
     self.assertIsInstance(cmd.parameters, (
         tuple,
         list,
     ))
コード例 #10
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_default_values_of_attributes(self):
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
     })
     self.assertIsNone(cmd.timestamp)
     self.assertIsNone(cmd.user_id)
     self.assertIsNone(cmd.lifetime)
     self.assertIsNone(cmd.flags)
     self.assertIsNone(cmd.status)
     self.assertIsNone(cmd.result)
コード例 #11
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
 def test_parameters_stored_in_attribute(self):
     expected_value = (
         1,
         2,
         3,
     )
     cmd = WsCommand.create({
         'id': 1,
         'command': 'test',
         'parameters': expected_value,
     })
     self.assertEqual(expected_value, cmd.parameters)
コード例 #12
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
    def test_default_dict(self):
        command_name = 'test'

        cmd = WsCommand.create({
            'id': 1,
            'command': command_name,
        })
        result = cmd.to_dict()

        self.assertDictEqual({
            'command': command_name,
            'parameters': [],
        }, result)
コード例 #13
0
    def test_can_serialize_attributes(self):
        command_name = 'test'
        lifetime = 1
        flags = 2

        cmd = WsCommand.create({'id': 1, 'command': command_name, 'lifetime': lifetime, 'flags': flags, })
        result = cmd.to_dict()

        self.assertDictEqual({
            'command': command_name,
            'parameters': [],
            'lifetime': lifetime,
            'flags': flags,
        }, result)
コード例 #14
0
ファイル: test_client_wscommand.py プロジェクト: sbambach/LiV
    def test_can_serialize_attributes(self):
        command_name = 'test'
        lifetime = 1
        flags = 2

        cmd = WsCommand.create({
            'id': 1,
            'command': command_name,
            'lifetime': lifetime,
            'flags': flags,
        })
        result = cmd.to_dict()

        self.assertDictEqual(
            {
                'command': command_name,
                'parameters': [],
                'lifetime': lifetime,
                'flags': flags,
            }, result)
コード例 #15
0
 def test_parameters_defaults_to_tuple(self):
     cmd = WsCommand.create({'id': 1, 'command': 'test', })
     self.assertIsInstance(cmd.parameters, (tuple, list, ))
コード例 #16
0
 def test_timestamp_can_be_set(self):
     expected_timestamp = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'timestamp': expected_timestamp, })
     self.assertEqual(expected_timestamp, cmd.timestamp)
コード例 #17
0
 def test_user_id_can_be_set(self):
     expected_user_id = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'userId': expected_user_id, })
     self.assertEqual(expected_user_id, cmd.user_id)
コード例 #18
0
 def test_lifetime_can_be_set(self):
     expected_lifetime = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'lifetime': expected_lifetime, })
     self.assertEqual(expected_lifetime, cmd.lifetime)
コード例 #19
0
 def test_flags_can_be_set(self):
     expected_flags = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'flags': expected_flags, })
     self.assertEqual(expected_flags, cmd.flags)
コード例 #20
0
 def test_status_can_be_set(self):
     expected_status = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'status': expected_status, })
     self.assertEqual(expected_status, cmd.status)
コード例 #21
0
 def test_result_can_be_set(self):
     expected_result = 1
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'result': expected_result, })
     self.assertEqual(expected_result, cmd.result)
コード例 #22
0
 def test_parameters_stored_in_attribute(self):
     expected_value = (1, 2, 3, )
     cmd = WsCommand.create({'id': 1, 'command': 'test', 'parameters': expected_value, })
     self.assertEqual(expected_value, cmd.parameters)