Skip to content

Add tool for easy mocking. #8

@kramarz

Description

@kramarz

Not sure if it is right place for this issue. Example from our tests:

identity_endpoint = mock.Mock()
    identity_endpoint.post.return_value = request_factory.ApiResponse(201, {"data": identity})

    def mock_endpoint(name):
        mapping = [
            (re.compile('^identities$'), identity_endpoint),
        ]
        for regexp, endpoint in mapping:
            if regexp.match(name):
                return endpoint
        else:
            return mock.Mock()
         api = mock.MagicMock()
         api.endpoint.side_effect = mock_endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions