Skip to content

Commit

Permalink
Merge pull request #635 from UW-GAC/deploy/stage
Browse files Browse the repository at this point in the history
Deploy to prod
  • Loading branch information
amstilp authored Jul 11, 2024
2 parents e0c20ab + 5184f94 commit d7395b6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
26 changes: 26 additions & 0 deletions gregor_django/gregor_anvil/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ def test_site_user_table(self):
self.assertIn(site_user, table.data)
self.assertNotIn(non_site_user, table.data)

def test_site_user_table_does_not_include_inactive_users(self):
"""Site user table does not include inactive users."""
obj = self.model_factory.create()
inactive_site_user = UserFactory.create()
inactive_site_user.research_centers.set([obj])
inactive_site_user.is_active = False
inactive_site_user.save()
self.client.force_login(self.user)
response = self.client.get(self.get_url(obj.pk))
table = response.context_data["tables"][0]
self.assertEqual(len(table.rows), 0)
self.assertNotIn(inactive_site_user, table.data)

def test_link_to_member_group(self):
"""Response includes a link to the members group if it exists."""
member_group = acm_factories.ManagedGroupFactory.create()
Expand Down Expand Up @@ -504,6 +517,19 @@ def test_site_user_table(self):
self.assertIn(pg_user, table.data)
self.assertNotIn(non_pg_user, table.data)

def test_site_user_table_does_not_include_inactive_users(self):
"""Site user table does not include inactive users."""
obj = self.model_factory.create()
inactive_site_user = UserFactory.create()
inactive_site_user.partner_groups.set([obj])
inactive_site_user.is_active = False
inactive_site_user.save()
self.client.force_login(self.user)
response = self.client.get(self.get_url(obj.pk))
table = response.context_data["tables"][0]
self.assertEqual(len(table.rows), 0)
self.assertNotIn(inactive_site_user, table.data)

def test_table_classes(self):
"""Table classes are correct."""
obj = self.model_factory.create()
Expand Down
4 changes: 2 additions & 2 deletions gregor_django/gregor_anvil/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_tables(self):
groupaccountmembership__group=self.object.uploader_group,
)
return [
UserTable(User.objects.filter(research_centers=self.object)),
UserTable(User.objects.filter(is_active=True, research_centers=self.object)),
tables.AccountTable(members, exclude=("user__research_centers", "number_groups")),
tables.AccountTable(uploaders, exclude=("user__research_centers", "number_groups")),
]
Expand Down Expand Up @@ -80,7 +80,7 @@ def get_tables(self):
groupaccountmembership__group=self.object.uploader_group,
)
return [
UserTable(User.objects.filter(partner_groups=self.object)),
UserTable(User.objects.filter(is_active=True, partner_groups=self.object)),
tables.AccountTable(members, exclude=("user__research_centers", "number_groups")),
tables.AccountTable(uploaders, exclude=("user__research_centers", "number_groups")),
]
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dill==0.3.8
# via pylint
distlib==0.3.8
# via virtualenv
django==4.2.13
django==4.2.14
# via
# -c requirements/requirements.txt
# django-debug-toolbar
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cryptography==42.0.4
# via pyjwt
defusedxml==0.7.1
# via python3-openid
django==4.2.13
django==4.2.14
# via
# -r requirements/requirements.in
# crispy-bootstrap5
Expand Down

0 comments on commit d7395b6

Please sign in to comment.