Skip to content

Commit

Permalink
Convert admin-stats tests to pytest format, use pytest fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccacremona committed Oct 1, 2024
1 parent a975ea4 commit 03ce9c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
21 changes: 21 additions & 0 deletions perma_web/perma/tests/test_views_admin_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django.urls import reverse

import pytest

@pytest.mark.parametrize(
"stat_type",
[
"days",
"celery",
"random",
"emails",
"job_queue"
]
)
def test_admin_stats(stat_type, client, admin_user):
client.force_login(admin_user)
response = client.get(
reverse('admin_stats', kwargs={"stat_type": stat_type}),
secure=True
)
assert response.status_code == 200
10 changes: 0 additions & 10 deletions perma_web/perma/tests/test_views_user_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -2633,13 +2633,3 @@ def test_password_reset_is_case_insensitive(self):

self.submit_form('password_reset', data={'email': self.randomize_capitalization(email)})
self.assertEqual(len(mail.outbox), 2)

### ADMIN STATS ###

def test_admin_stats(self):
self.log_in_user(self.admin_user)
self.get('admin_stats', reverse_kwargs={'args':['days']})
self.get('admin_stats', reverse_kwargs={'args':['celery']})
self.get('admin_stats', reverse_kwargs={'args':['random']})
self.get('admin_stats', reverse_kwargs={'args':['emails']})
self.get('admin_stats', reverse_kwargs={'args':['job_queue']})

0 comments on commit 03ce9c7

Please sign in to comment.