Skip to content

Instantly share code, notes, and snippets.

@Luttik
Last active July 30, 2020 14:10
Show Gist options
  • Select an option

  • Save Luttik/b2edee0645c318f6ef60c154725d1400 to your computer and use it in GitHub Desktop.

Select an option

Save Luttik/b2edee0645c318f6ef60c154725d1400 to your computer and use it in GitHub Desktop.
An example locker call
@patch.object(XyzAPI, "XyzCall")
def test_contact_routing(mock: MagicMock, locker: Locker):
do_logic_that_calls_xyz()
# Uses json to serialize response
# call_args_list contains the data for all calls that XyzApi.XyzCall got
# indent=2 for readibility
# sort_keys=True for deterministic serialization of dictionaries.
locker.lock(json.dumps(mock.call_args_list, indent=2, sort_keys=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment