Skip to content

Commit

Permalink
account controller - view_test (manage, add, remove)
Browse files Browse the repository at this point in the history
  • Loading branch information
janik committed Aug 21, 2024
1 parent b8cc926 commit 6a40414
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions quafelweb/account_controller/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def setUp(self):
self.client = Client()

self.account_url = reverse('account')
self.add_url = reverse('add')
self.delete_url = reverse('delete')
self.add_url = reverse('add_account')
self.delete_url = reverse('delete_account')

self.account1 = AdminAccount.objects.create(identifier='admin1')
def test_manage_accounts_GET(self):
Expand Down Expand Up @@ -67,4 +67,15 @@ def test_remove_accounts_POST_no_data(self):
self.assertEquals(response.status_code, 302)
self.assertEquals(new_count, initial_count)

def test_accounts_is_logged_in(self):

initial_count = AdminAccount.objects.count()

response = self.client.post(self.delete_url)

new_count = AdminAccount.objects.count()

self.assertEquals(response.status_code, 302)
self.assertEquals(new_count, initial_count)


4 changes: 2 additions & 2 deletions quafelweb/account_controller/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

urlpatterns = [
path("", views.AccountView.manage_accounts, name="account"),
path("add/", views.AccountView.add_admin, name="add"),
path("delete/", views.AccountView.remove_admin, name="delete"),
path("add/", views.AccountView.add_admin, name="add_account"),
path("delete/", views.AccountView.remove_admin, name="delete_account"),
path("login/", views.AccountView.authenticate, name="login"),
path("logout/", views.AccountView.logout, name="logout"),
path("auth/", views.AccountView.authenticate_callback, name="auth_callback"),
Expand Down
2 changes: 1 addition & 1 deletion quafelweb/hardware_controller/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

urlpatterns = [
path("", views.HardwareView.manage_profiles, name="hardware"),
path("add/", views.HardwareView.add_profile),
path("add/", views.HardwareView.add_profile, name="add_hardware"),
path("delete/", views.HardwareView.delete_profile, name="delete_hardware"),
path("delete_confirm/", views.HardwareView.delete_runs, name="delete_confirm"),
path("configure/", views.HardwareView.configure_profile, name="configure_hardware"),
Expand Down

0 comments on commit 6a40414

Please sign in to comment.