diff options
Diffstat (limited to 'archaeological_files/tests.py')
-rw-r--r-- | archaeological_files/tests.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py index 2b0a63af8..82f85e7c9 100644 --- a/archaeological_files/tests.py +++ b/archaeological_files/tests.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -17,14 +17,13 @@ # See the file COPYING for details. -""" -Unit tests -""" import datetime import json from django.conf import settings from django.contrib.auth.models import User +from django.core.urlresolvers import reverse +from django.test.client import Client from ishtar_common.tests import TestCase @@ -225,11 +224,19 @@ class FileTest(TestCase, FileInit): # our parcel has no operation attached and should be deleted self.assertEqual(parcel_nb - 1, Parcel.objects.count()) -# class ImporterTest(TestCase): -# def testFormaters(self): -# from archaeological_files import data_importer -# for formater in [data_importer.SurfaceFormater]: -# formater().test() + def test_show(self): + c = Client() + url = 'show-file' + pk = self.item.pk + response = self.client.get(reverse(url, kwargs={'pk': pk})) + self.assertEqual(response.status_code, 200) + # empty content when not allowed + self.assertEqual(response.content, "") + + self.login_as_superuser() + response = self.client.get(reverse(url, kwargs={'pk': pk})) + self.assertEqual(response.status_code, 200) + self.assertIn('class="sheet"', response.content) class FileOperationTest(TestCase, OperationInitTest, FileInit): |