def test_iot_digitaltwin_command_list_error(self, fixture_cmd,
                                             serviceclient_generic_error,
                                             exp):
     with pytest.raises(exp):
         subject.iot_digitaltwin_command_list(fixture_cmd,
                                              device_id=device_id,
                                              source_model='public',
                                              login=mock_target['cs'])
 def test_iot_digitaltwin_command_list_args_error(self, fixture_cmd,
                                                  serviceclient, interface,
                                                  exp):
     with pytest.raises(exp):
         subject.iot_digitaltwin_command_list(fixture_cmd,
                                              device_id=device_id,
                                              interface=interface,
                                              login=mock_target['cs'],
                                              source_model='public')
    def test_iot_digitaltwin_command_list(self, fixture_cmd, serviceclient):
        result = subject.iot_digitaltwin_command_list(
            fixture_cmd,
            device_id=device_id,
            source_model='public',
            interface='environmentalSensor',
            login=mock_target['cs'])
        args = serviceclient.call_args
        url = args[0][0].url
        method = args[0][0].method

        assert method == 'GET'
        assert '/models/' in url
        assert json.dumps(result)
        assert len(result['interfaces']) == 1
        assert result['interfaces'][0]['name'] == 'environmentalSensor'
        assert len(result['interfaces'][0]['commands']) == 3
Example #4
0
    def test_iot_digitaltwin_command_list(self, fixture_cmd, serviceclient):
        result = subject.iot_digitaltwin_command_list(
            fixture_cmd,
            device_id=device_id,
            source_model="public",
            interface="environmentalSensor",
            login=mock_target["cs"],
        )
        args = serviceclient.call_args
        url = args[0][0].url
        method = args[0][0].method

        assert method == "GET"
        assert "/models/" in url
        assert json.dumps(result)
        assert len(result["interfaces"]) == 1
        assert result["interfaces"][0]["name"] == "environmentalSensor"
        assert len(result["interfaces"][0]["commands"]) == 3