Skip to content

Commit

Permalink
Add a test for two data prep workspaces associated with the workspace.
Browse files Browse the repository at this point in the history
  • Loading branch information
wkirdp committed Mar 14, 2024
1 parent d327c4f commit 6d8fd7d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions primed/cdsa/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7288,6 +7288,29 @@ def test_only_show_one_associated_data_prep_workspace(self):
response.context_data["associated_data_prep_workspaces"].data,
)

def test_show_two_associated_data_prep_workspaces(self):
cdsa_obj = factories.CDSAWorkspaceFactory.create()
dataPrep_obj1 = DataPrepWorkspaceFactory.create(
target_workspace=cdsa_obj.workspace
)
dataPrep_obj2 = DataPrepWorkspaceFactory.create(
target_workspace=cdsa_obj.workspace
)
self.client.force_login(self.user)
response = self.client.get(cdsa_obj.get_absolute_url())
self.assertIn("associated_data_prep_workspaces", response.context_data)
self.assertEqual(
len(response.context_data["associated_data_prep_workspaces"].rows), 2
)
self.assertIn(
dataPrep_obj1.workspace,
response.context_data["associated_data_prep_workspaces"].data,
)
self.assertIn(
dataPrep_obj2.workspace,
response.context_data["associated_data_prep_workspaces"].data,
)


class CDSAWorkspaceCreateTest(AnVILAPIMockTestMixin, TestCase):
"""Tests of the WorkspaceCreate view from ACM with this app's CDSAWorkspace model."""
Expand Down
23 changes: 23 additions & 0 deletions primed/dbgap/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,29 @@ def test_only_show_one_associated_data_prep_workspace(self):
response.context_data["associated_data_prep_workspaces"].data,
)

def test_show_two_associated_data_prep_workspaces(self):
dbGaP_obj = factories.dbGaPWorkspaceFactory.create()
dataPrep_obj1 = DataPrepWorkspaceFactory.create(
target_workspace=dbGaP_obj.workspace
)
dataPrep_obj2 = DataPrepWorkspaceFactory.create(
target_workspace=dbGaP_obj.workspace
)
self.client.force_login(self.user)
response = self.client.get(dbGaP_obj.get_absolute_url())
self.assertIn("associated_data_prep_workspaces", response.context_data)
self.assertEqual(
len(response.context_data["associated_data_prep_workspaces"].rows), 2
)
self.assertIn(
dataPrep_obj1.workspace,
response.context_data["associated_data_prep_workspaces"].data,
)
self.assertIn(
dataPrep_obj2.workspace,
response.context_data["associated_data_prep_workspaces"].data,
)


class dbGaPWorkspaceCreateTest(AnVILAPIMockTestMixin, TestCase):
"""Tests of the WorkspaceCreate view from ACM with this app's dbGaPWorkspace model."""
Expand Down

0 comments on commit 6d8fd7d

Please sign in to comment.