Skip to content

Commit

Permalink
Update briefcase api tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lincoln Simba <[email protected]>
  • Loading branch information
lincmba committed Jan 2, 2019
1 parent 44e93ef commit 1e61172
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions onadata/apps/logger/tests/test_briefcase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
import shutil
from io import open

from django.core.urlresolvers import reverse
from django.contrib.auth import authenticate
from django.core.files.storage import get_storage_class
from django.core.urlresolvers import reverse
from django_digest.test import DigestAuth
from rest_framework.test import APIRequestFactory
from django.contrib.auth import authenticate

from onadata.apps.main.tests.test_base import TestBase
from onadata.apps.logger.views import view_submission_list
from onadata.apps.logger.views import view_download_submission
from onadata.apps.logger.views import form_upload
from onadata.apps.logger.models import Instance
from onadata.apps.logger.models import XForm
from onadata.apps.logger.views import form_upload
from onadata.apps.logger.views import submission
from onadata.apps.logger.views import view_download_submission
from onadata.apps.logger.views import view_submission_list
from onadata.apps.main.tests.test_base import TestBase

NUM_INSTANCES = 4
NUM_INSTANCES = 5
storage = get_storage_class()()


Expand Down Expand Up @@ -86,7 +86,7 @@ def test_view_submission_list_w_deleted_submission(self):
self.assertEqual(response.status_code, 200)
submission_list_path = os.path.join(
self.this_directory, 'fixtures', 'transportation',
'view', 'submissionList-4.xml')
'view', 'submissionList-5.xml')
instances = ordered_instances(self.xform)

self.assertEqual(instances.count(), NUM_INSTANCES - 1)
Expand Down Expand Up @@ -145,7 +145,7 @@ def get_last_index(xform, last_index=None):

last_index = instances[:2][1].pk
last_expected_submission_list = ""
for index in range(1, 5):
for index in range(1, 6):
request = self.factory.get(self._submission_list_url, params)
response = view_submission_list(request, self.user.username)
self.assertEqual(response.status_code, 401)
Expand All @@ -158,7 +158,7 @@ def get_last_index(xform, last_index=None):
last_index = get_last_index(self.xform, last_index)
filename = 'submissionList-%s.xml' % index

if index == 4:
if index == 5:
self.assertEqual(response.content.decode('utf-8'),
last_expected_submission_list)
continue
Expand Down
10 changes: 5 additions & 5 deletions onadata/apps/main/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
import os
import re
import socket
from builtins import open
from future.moves.urllib.error import URLError
from future.moves.urllib.request import urlopen
from io import StringIO
from tempfile import NamedTemporaryFile

from builtins import open
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.test import RequestFactory, TransactionTestCase
from django.test.client import Client
from django.utils import timezone

from django_digest.test import Client as DigestClient
from django_digest.test import DigestAuth
from future.moves.urllib.error import URLError
from future.moves.urllib.request import urlopen
from pyxform.tests_v1.pyxform_test_case import PyxformMarkdown
from rest_framework.test import APIRequestFactory

Expand All @@ -39,7 +38,8 @@ class TestBase(PyxformMarkdown, TransactionTestCase):
surveys = ['transport_2011-07-25_19-05-49',
'transport_2011-07-25_19-05-36',
'transport_2011-07-25_19-06-01',
'transport_2011-07-25_19-06-14']
'transport_2011-07-25_19-06-14',
'transport_2011-07-25_19-05-49_1']
this_directory = os.path.abspath(os.path.dirname(__file__))

def setUp(self):
Expand Down

0 comments on commit 1e61172

Please sign in to comment.