diff options
-rw-r--r-- | archaeological_operations/tests.py | 19 | ||||
-rw-r--r-- | ishtar_common/tests.py | 30 |
2 files changed, 49 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 49cec3640..ebaaa54ad 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1044,6 +1044,25 @@ class OperationSearchTest(TestCase, OperationInitTest): self.assertTrue(json.loads(response.content)['total'] == 1) +class DashboardTest(TestCase, OperationInitTest): + fixtures = FILE_FIXTURES + + def setUp(self): + IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) + self.username, self.password, self.user = create_superuser() + self.orgas = self.create_orgas(self.user) + self.operations = self.create_operation(self.user, self.orgas[0]) + + def test_dashboard(self): + url = 'dashboard-operation' + c = Client() + c.login(username=self.username, password=self.password) + + response = c.get(reverse(url)) + self.assertEqual(response.status_code, 200) + + def create_administrativact(user, operation): act_type, created = models.ActType.objects.get_or_create( txt_idx='act_type_O', intented_to='O') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index af2dee047..4afc74c9b 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -1105,3 +1105,33 @@ class AccountWizardTest(WizardTest, TestCase): self.assertEqual(user.email, "test@example.com") self.assertEqual(models.IshtarUser.objects.count(), self.account_number + 1) + + +class DashboardTest(TestCase): + + def setUp(self): + self.username, self.password, self.user = create_superuser() + profile, created = models.IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) + profile.files = True + profile.context_record = True + profile.find = True + profile.warehouse = True + profile.save() + + def test_dashboard(self): + c = Client() + c.login(username=self.username, password=self.password) + + url = 'dashboard-main-detail' + + response = c.get(reverse(url, kwargs={'item_name': "zorglub"})) + self.assertEqual( + response.status_code, 404) + + for item in ['users', 'files', 'treatmentfiles', 'treatments', + 'operations', 'contextrecords', 'finds']: + response = c.get(reverse(url, kwargs={'item_name': item})) + self.assertEqual( + response.status_code, 200, + "Reaching dashboard for item: {} return an error.".format(url)) |