Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian leggett committed Oct 29, 2024
1 parent e26cb71 commit 6cf3ecf
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions dataworkspace/dataworkspace/tests/datasets/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5004,9 +5004,8 @@ def test_master_dataset_detail_page_shows_pipeline_failures(client, metadata_db)


class TestDataSetReviewAccess:
def setUp(
self, eligibility_criteria=["You need to be eligible"], eligibility_criteria_met=True
):
def setUp(self, eligibility_criteria=False, eligibility_criteria_met=True):
criteria = [eligibility_criteria] if eligibility_criteria else None
self.user = factories.UserFactory.create(is_superuser=True)
self.client = Client(**get_http_sso_data(self.user))
self.user_requestor = factories.UserFactory.create(
Expand All @@ -5019,7 +5018,7 @@ def setUp(
published=True,
type=DataSetType.MASTER,
name="Master",
eligibility_criteria=eligibility_criteria,
eligibility_criteria=criteria,
)
AccessRequestFactory(
id=self.user_requestor.id,
Expand Down Expand Up @@ -5086,7 +5085,7 @@ def assert_eligibility_requirements_details(self, soup):

@pytest.mark.django_db
def test_user_has_met_eligibility_requirements(self):
self.setUp()
self.setUp("You need to be eligible")
[soup, _] = self.assert_common()
self.assert_eligibility_requirements_details(soup)
requesters_eligibility_requirements_answer = soup.find("details").find_next_sibling("p")
Expand All @@ -5097,7 +5096,7 @@ def test_user_has_met_eligibility_requirements(self):

@pytest.mark.django_db
def test_user_has_not_met_eligibility_requirements(self):
self.setUp(eligibility_criteria_met=False)
self.setUp("You need to be eligible", eligibility_criteria_met=False)
[soup, _] = self.assert_common()
self.assert_eligibility_requirements_details(soup)
requesters_eligibility_requirements_answer = soup.find("details").find_next_sibling("p")
Expand All @@ -5115,7 +5114,7 @@ def test_user_has_not_met_eligibility_requirements(self):

@pytest.mark.django_db
def test_dataset_does_not_have_eligibility_requirements(self):
self.setUp(eligibility_criteria=None)
self.setUp()
[_, response] = self.assert_common()
assert "Have the eligibility requirements been met?" not in response.content.decode(
response.charset
Expand Down

0 comments on commit 6cf3ecf

Please sign in to comment.