Пример #1
0
    def test_that_when_describing_thing_type_and_thing_type_does_not_exists_the_describe_thing_type_method_returns_none(self):
        '''
        Tests describe thing type for an non existent thing type
        '''
        self.conn.describe_thing_type.side_effect = not_found_error
        result = boto_iot.describe_thing_type(thingTypeName='non existent thing type', **conn_parameters)

        self.assertEqual(result.get('thing_type'), None)
Пример #2
0
    def test_that_when_describing_thing_type_and_thing_type_exists_the_describe_thing_type_method_returns_thing_type(self):
        '''
        Tests describe thing type for an existing thing type
        '''
        self.conn.describe_thing_type.return_value = thing_type_ret
        result = boto_iot.describe_thing_type(thingTypeName=thing_type_name, **conn_parameters)

        self.assertEqual(result.get('thing_type'), thing_type_ret)
Пример #3
0
    def test_that_when_describing_thing_type_and_boto3_returns_error_an_error_the_describe_thing_type_method_returns_error(
        self,
    ):
        self.conn.describe_thing_type.side_effect = ClientError(
            error_content, "describe_thing_type"
        )
        result = boto_iot.describe_thing_type(thingTypeName="mythingtype", **conn_parameters)

        assert result.get("error", {}).get("message") == error_message.format("describe_thing_type")
Пример #4
0
    def test_that_when_describing_thing_type_and_boto3_returns_error_an_error_the_describe_thing_type_method_returns_error(
            self):
        self.conn.describe_thing_type.side_effect = ClientError(
            error_content, 'describe_thing_type')
        result = boto_iot.describe_thing_type(thingTypeName='mythingtype',
                                              **conn_parameters)

        self.assertEqual(
            result.get('error', {}).get('message'),
            error_message.format('describe_thing_type'))
Пример #5
0
    def test_that_when_describing_thing_type_and_thing_type_exists_the_describe_thing_type_method_returns_thing_type(
        self,
    ):
        """
        Tests describe thing type for an existing thing type
        """
        self.conn.describe_thing_type.return_value = thing_type_ret
        result = boto_iot.describe_thing_type(thingTypeName=thing_type_name, **conn_parameters)

        assert result.get("thing_type") == thing_type_ret
Пример #6
0
def test_that_when_describing_thing_type_and_boto3_returns_error_an_error_the_describe_thing_type_method_returns_error(
        boto_conn):
    boto_conn.describe_thing_type.side_effect = exceptions.ClientError(
        error_content, 'describe_thing_type')
    result = boto_iot.describe_thing_type(thingTypeName='mythingtype',
                                          **pytest.conn_parameters)

    assert result.get(
        'error',
        {}).get('message') == error_message.format('describe_thing_type')
Пример #7
0
def test_that_when_describing_thing_type_and_thing_type_does_not_exists_the_describe_thing_type_method_returns_none(
        boto_conn):
    '''
    Tests describe thing type for an non existent thing type
    '''
    boto_conn.describe_thing_type.side_effect = not_found_error
    result = boto_iot.describe_thing_type(
        thingTypeName='non existent thing type', **pytest.conn_parameters)

    assert result.get('thing_type') == None
Пример #8
0
def test_that_when_describing_thing_type_and_thing_type_exists_the_describe_thing_type_method_returns_thing_type(
        boto_conn):
    '''
    Tests describe thing type for an existing thing type
    '''
    boto_conn.describe_thing_type.return_value = thing_type_ret
    result = boto_iot.describe_thing_type(thingTypeName=thing_type_name,
                                          **pytest.conn_parameters)

    assert result.get('thing_type') == thing_type_ret
Пример #9
0
    def test_that_when_describing_thing_type_and_thing_type_does_not_exists_the_describe_thing_type_method_returns_none(
        self,
    ):
        """
        Tests describe thing type for an non existent thing type
        """
        self.conn.describe_thing_type.side_effect = not_found_error
        result = boto_iot.describe_thing_type(
            thingTypeName="non existent thing type", **conn_parameters
        )

        assert result.get("thing_type") == None