Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mocked_fetch_url(*args, **kwargs):
- if args[0] == 'https://api.meraki.com/404':
- info = {'status': 404,
- 'body': "404 - Page is missing",
- }
- return (None, info)
- @mock.patch('ansible.module_utils.urls.fetch_url', spec=mocked_fetch_url)
- def test_fetch_url_404(module, mocker):
- url = 'https://api.meraki.com/404'
- data = module.request(url, method='GET')
- print(data)
- assert module.status == 404
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement