Skip to content

Commit

Permalink
NES-1026 Refactors ExportTestCase to inherit from ExperimentTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassiano R. N. dos Santos committed Sep 16, 2020
1 parent 2dd7b17 commit 61d2988
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions patientregistrationsystem/qdc/export/tests/tests_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,17 @@
from django.test import TestCase

from custom_user.tests_helper import create_user
from experiment.tests.tests_helper import ObjectsFactory
from experiment.tests.tests_helper import ObjectsFactory, ExperimentTestCase
from patient.tests.tests_orig import UtilTests


class ExportTestCase(TestCase):
class ExportTestCase(ExperimentTestCase):

def setUp(self):
# create the groups of users and their permissions
exec(open('add_initial_data.py').read())

# return user password to use when necessary in subclasses
self.user, self.user_passwd = create_user(Group.objects.all())
self.client.login(username=self.user.username, password=self.user_passwd)

# create experiment/experimental protocol/group
self.research_project = ObjectsFactory.create_research_project(self.user)
self.experiment = ObjectsFactory.create_experiment(self.research_project)
self.root_component = ObjectsFactory.create_block(self.experiment)
self.group = ObjectsFactory.create_group(self.experiment, self.root_component)

# create patient/subject/subject_of_group
self.patient = UtilTests().create_patient(changed_by=self.user)
subject = ObjectsFactory.create_subject(self.patient)
self.subject_of_group = ObjectsFactory.create_subject_of_group(self.group, subject)
super(ExportTestCase, self).setUp()

self.client.login(username=self.user.username,
password=self.user_passwd)

def append_session_variable(self, key, value):
"""See:
Expand Down

0 comments on commit 61d2988

Please sign in to comment.