diff --git a/.gitignore b/.gitignore index 289210e..f90e8ec 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ tags dhcpd.* webvirtcloud/settings.py *migrations/* +.coverage +htmlcov \ No newline at end of file diff --git a/accounts/admin.py b/accounts/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/accounts/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/accounts/backends.py b/accounts/backends.py deleted file mode 100644 index e66b94a..0000000 --- a/accounts/backends.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.contrib.auth.backends import RemoteUserBackend -from accounts.models import UserInstance, UserAttributes -from instances.models import Instance - -class MyRemoteUserBackend(RemoteUserBackend): - - #create_unknown_user = True - - def configure_user(self, user): - #user.is_superuser = True - UserAttributes.configure_user(user) - return user - diff --git a/admin/templates/admin/common/form.html b/admin/templates/admin/common/form.html index 4ff3fd3..ced001e 100644 --- a/admin/templates/admin/common/form.html +++ b/admin/templates/admin/common/form.html @@ -11,6 +11,7 @@ +{% bootstrap_messages %}
diff --git a/admin/tests.py b/admin/tests.py index 09049dc..b030436 100644 --- a/admin/tests.py +++ b/admin/tests.py @@ -9,29 +9,33 @@ from accounts.models import UserAttributes class AdminTestCase(TestCase): def setUp(self): self.client.login(username='admin', password='admin') - # User.objects.create_user(username='test', password='test') - - # def test_user(self): - # user = User.objects.get(username='test') - # self.assertEqual(user.id, 2) def test_group_list(self): response = self.client.get(reverse('admin:group_list')) self.assertEqual(response.status_code, 200) def test_groups(self): + response = self.client.get(reverse('admin:group_create')) + self.assertEqual(response.status_code, 200) + response = self.client.post(reverse('admin:group_create'), {'name': 'Test Group'}) self.assertRedirects(response, reverse('admin:group_list')) group = Group.objects.get(name='Test Group') self.assertEqual(group.id, 1) + response = self.client.get(reverse('admin:group_update', args=[1])) + self.assertEqual(response.status_code, 200) + response = self.client.post(reverse('admin:group_update', args=[1]), {'name': 'Updated Group Test'}) self.assertRedirects(response, reverse('admin:group_list')) group = Group.objects.get(id=1) self.assertEqual(group.name, 'Updated Group Test') + response = self.client.get(reverse('admin:group_delete', args=[1])) + self.assertEqual(response.status_code, 200) + response = self.client.post(reverse('admin:group_delete', args=[1])) self.assertRedirects(response, reverse('admin:group_list')) @@ -43,6 +47,9 @@ class AdminTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_users(self): + response = self.client.get(reverse('admin:user_create')) + self.assertEqual(response.status_code, 200) + response = self.client.post( reverse('admin:user_create'), { @@ -66,6 +73,9 @@ class AdminTestCase(TestCase): self.assertEqual(ua.max_memory, 1024) self.assertEqual(ua.max_disk_size, 4) + response = self.client.get(reverse('admin:user_update', args=[2])) + self.assertEqual(response.status_code, 200) + response = self.client.post( reverse('admin:user_update', args=[2]), { @@ -96,12 +106,15 @@ class AdminTestCase(TestCase): user = User.objects.get(id=2) self.assertTrue(user.is_active) + response = self.client.get(reverse('admin:user_delete', args=[2])) + self.assertEqual(response.status_code, 200) + response = self.client.post(reverse('admin:user_delete', args=[2])) self.assertRedirects(response, reverse('admin:user_list')) with self.assertRaises(ObjectDoesNotExist): User.objects.get(id=2) - def test_user_logs(self): + def test_logs(self): response = self.client.get(reverse('admin:logs')) self.assertEqual(response.status_code, 200) diff --git a/computes/admin.py b/computes/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/computes/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/conf/requirements.txt b/conf/requirements.txt index af0e93a..bbddbd3 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,3 +1,4 @@ +coverage==5.1 Django==2.2.12 django-bootstrap3==12.1.0 django-fa==1.0.0 diff --git a/console/admin.py b/console/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/console/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/create/admin.py b/create/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/create/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/datasource/admin.py b/datasource/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/datasource/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/instances/admin.py b/instances/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/instances/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/interfaces/admin.py b/interfaces/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/interfaces/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/logs/admin.py b/logs/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/logs/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/networks/admin.py b/networks/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/networks/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/nwfilters/admin.py b/nwfilters/admin.py deleted file mode 100644 index 13be29d..0000000 --- a/nwfilters/admin.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.contrib import admin - -# Register your models here. diff --git a/secrets/admin.py b/secrets/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/secrets/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/storages/admin.py b/storages/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/storages/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here.