Beispiel #1
0
 def test_parse_sys_info_error(self, mock_get):
     device = self.create_device()
     data = XmlApiObject({})
     data.url = SYSTEM_INFORMATION_URL
     device.actions["getSystemInformation"] = data
     device._parse_system_information()
     self.assertEqual(device.mac, None)
Beispiel #2
0
 def add_register_to_device(device, mode):
     register_action = XmlApiObject({})
     register_action.mode = mode
     if mode < 4:
         register_action.url = REGISTRATION_URL_LEGACY
     else:
         register_action.url = REGISTRATION_URL_V4
     device.actions["register"] = register_action
Beispiel #3
0
 def test_update_commands_v4(self, mock_get):
     device = self.create_device()
     device.pin = 1234
     device.api_version = 4
     action = XmlApiObject({})
     action.url = GET_REMOTE_CONTROLLER_INFO_URL
     device.actions["getRemoteCommandList"] = action
     device._update_commands()
Beispiel #4
0
 def test_get_action(self, mock_init_device):
     device = self.create_device()
     action = XmlApiObject({})
     action.name = "test"
     with self.assertRaises(ValueError):
         device._get_action(action.name)
     self.assertEqual(mock_init_device.call_count, 1)
     device.actions[action.name] = action
     self.assertEqual(device._get_action(action.name), action)
Beispiel #5
0
 def create_command_list(device):
     """Create a list with commands"""
     command = XmlApiObject({})
     command.name = "test"
     device.commands[command.name] = command
Beispiel #6
0
 def test_register_no_auth_error(self, mocked_get):
     device = self.create_device()
     register_action = XmlApiObject({})
     register_action.url = REQUESTS_ERROR
     self.assertEqual(AuthenticationResult.ERROR,
                      device._register_without_auth(register_action))
Beispiel #7
0
 def prepare_test_action_list(self):
     device = self.create_device()
     data = XmlApiObject({})
     data.url = GET_REMOTE_COMMAND_LIST_URL
     device.actions["getRemoteCommandList"] = data
     return device