summaryrefslogtreecommitdiff
path: root/archaeological_files/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-07-03 13:04:01 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-07-03 13:04:01 +0200
commitb214c0f86a0389c674dce661c52296f46dc782c1 (patch)
treeae9988824192ecdfef3391796e7d2ee358b8a947 /archaeological_files/tests.py
parent2f05339db6fb373bf90c053907b811a05bee4769 (diff)
downloadIshtar-b214c0f86a0389c674dce661c52296f46dc782c1.tar.bz2
Ishtar-b214c0f86a0389c674dce661c52296f46dc782c1.zip
Archaeologivcal files: safely manage is_preventive test if preventive type is not created - show-file test
Diffstat (limited to 'archaeological_files/tests.py')
-rw-r--r--archaeological_files/tests.py25
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):