Skip to content

Commit

Permalink
Update mocked data to reflect expected data
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Sep 3, 2020
1 parent feb87d4 commit 80aeb66
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions onadata/apps/api/tests/viewsets/test_data_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@


@urlmatch(netloc=r'(.*\.)?enketo\.ona\.io$')
def enketo_mock(url, request):
def enketo_edit_mock(url, request):
response = requests.Response()
response.status_code = 201
response._content = '{"url": "https://hmh2a.enketo.ona.io"}'
response._content = (
'{"edit_url": "https://hmh2a.enketo.ona.io/edit/XA0bG8D'
'f?instance_id=672927e3-9ad4-42bb-9538-388ea1fb6699&retu'
'rnUrl=example.com", "code": 201}')
return response


Expand Down Expand Up @@ -1161,11 +1164,12 @@ def test_get_enketo_edit_url(self):
'/',
data={'return_url': "http://test.io/test_url"}, **self.extra)

with HTTMock(enketo_mock):
with HTTMock(enketo_edit_mock):
response = view(request, pk=formid, dataid=dataid)
self.assertEqual(
response.data['url'],
"https://hmh2a.enketo.ona.io")
"https://hmh2a.enketo.ona.io/edit/XA0bG8Df?instance_id="
"672927e3-9ad4-42bb-9538-388ea1fb6699&returnUrl=example.com")

with HTTMock(enketo_mock_http_413):
response = view(request, pk=formid, dataid=dataid)
Expand Down

0 comments on commit 80aeb66

Please sign in to comment.