def test_that_when_checking_if_a_thing_type_exists_and_boto3_returns_an_error_the_thing_type_exists_method_returns_error(self): ''' Tests checking iot thing type existence when boto returns an error ''' self.conn.describe_thing_type.side_effect = ClientError(error_content, 'describe_thing_type') result = boto_iot.thing_type_exists(thingTypeName='mythingtype', **conn_parameters) self.assertEqual(result.get('error', {}).get('message'), error_message.format('describe_thing_type'))
def test_that_when_checking_if_a_thing_type_exists_and_a_thing_type_does_not_exist_the_thing_type_exists_method_returns_false(self): ''' Tests checking iot thing type existence when the iot thing type does not exist ''' self.conn.describe_thing_type.side_effect = not_found_error result = boto_iot.thing_type_exists(thingTypeName='non existent thing type', **conn_parameters) self.assertFalse(result['exists'])
def test_that_when_checking_if_a_thing_type_exists_and_a_thing_type_exists_the_thing_type_exists_method_returns_true(self): ''' Tests checking iot thing type existence when the iot thing type already exists ''' self.conn.describe_thing_type.return_value = thing_type_ret result = boto_iot.thing_type_exists(thingTypeName=thing_type_name, **conn_parameters) self.assertTrue(result['exists'])
def test_that_when_checking_if_a_thing_type_exists_and_boto3_returns_an_error_the_thing_type_exists_method_returns_error( self, ): """ Tests checking iot thing type existence when boto returns an error """ self.conn.describe_thing_type.side_effect = ClientError( error_content, "describe_thing_type" ) result = boto_iot.thing_type_exists(thingTypeName="mythingtype", **conn_parameters) assert result.get("error", {}).get("message") == error_message.format("describe_thing_type")
def test_that_when_checking_if_a_thing_type_exists_and_a_thing_type_does_not_exist_the_thing_type_exists_method_returns_false( self, ): """ Tests checking iot thing type existence when the iot thing type does not exist """ self.conn.describe_thing_type.side_effect = not_found_error result = boto_iot.thing_type_exists( thingTypeName="non existent thing type", **conn_parameters ) assert not result["exists"]
def test_that_when_checking_if_a_thing_type_exists_and_boto3_returns_an_error_the_thing_type_exists_method_returns_error( boto_conn): ''' Tests checking iot thing type existence when boto returns an error ''' boto_conn.describe_thing_type.side_effect = exceptions.ClientError( error_content, 'describe_thing_type') result = boto_iot.thing_type_exists(thingTypeName='mythingtype', **pytest.conn_parameters) assert result.get( 'error', {}).get('message') == error_message.format('describe_thing_type')