summaryrefslogtreecommitdiffstats
path: root/core/TESTS
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-01-30 23:04:11 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-01-30 23:04:11 +0000
commit3aca0d0c76364c8f9fa3fec43370f54f8270b43f (patch)
tree135ded90255f67bc00bb2c78a832f4328d05c6d9 /core/TESTS
parente35fccea5d52bd9f64820335a7bf1dbd38e6157e (diff)
downloadtroggle-3aca0d0c76364c8f9fa3fec43370f54f8270b43f.tar.gz
troggle-3aca0d0c76364c8f9fa3fec43370f54f8270b43f.tar.bz2
troggle-3aca0d0c76364c8f9fa3fec43370f54f8270b43f.zip
ruf cleanup imports, bigly.
Diffstat (limited to 'core/TESTS')
-rw-r--r--core/TESTS/tests.py10
-rw-r--r--core/TESTS/tests_caves.py5
-rw-r--r--core/TESTS/tests_logins.py21
3 files changed, 14 insertions, 22 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index 5176859..3f60394 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -26,10 +26,8 @@ todo = """ADD TESTS when we are redirecting /expofiles/ to a remote file-deliver
"""
import re
-import unittest
-from http import HTTPStatus
-from django.test import Client, SimpleTestCase, TestCase
+from django.test import Client, TestCase
# class SimplePageTest(unittest.TestCase):
@@ -76,12 +74,12 @@ class PageTests(TestCase):
def test_expoweb_dir(self):
response = self.client.get("/handbook")
- content = response.content.decode()
+ response.content.decode()
self.assertEqual(response.status_code, 302) # directory, so redirects to /index.htm
def test_expoweb_dirslash(self):
response = self.client.get("/handbook/")
- content = response.content.decode()
+ response.content.decode()
self.assertEqual(response.status_code, 302) # directory, so redirects to /index.htm
def test_expoweb_dir_no_index(self):
@@ -211,7 +209,7 @@ class PageTests(TestCase):
def test_page_admindocs_exped(self):
# Get redirected to login page
response = self.client.get("/admin/doc/models/core.expedition/")
- content = response.content.decode()
+ response.content.decode()
self.assertEqual(response.status_code, 302)
def test_page_expofiles_root_dir(self):
diff --git a/core/TESTS/tests_caves.py b/core/TESTS/tests_caves.py
index 3d9270d..529c712 100644
--- a/core/TESTS/tests_caves.py
+++ b/core/TESTS/tests_caves.py
@@ -3,12 +3,11 @@ Modified for Expo April 2021.
"""
import re
-import unittest
-from django.test import Client, SimpleTestCase, TestCase
+from django.test import Client, TestCase
from troggle.core.models.caves import Area, Cave
-from troggle.core.models.troggle import Expedition, Person, PersonExpedition
+from troggle.core.models.troggle import Person, PersonExpedition
class FixtureTests(TestCase):
diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py
index 365ec04..0dae63e 100644
--- a/core/TESTS/tests_logins.py
+++ b/core/TESTS/tests_logins.py
@@ -7,14 +7,12 @@ Modified for Expo April 2021.
import pathlib
import re
-import subprocess
-import unittest
from http import HTTPStatus
-from django.test import Client, SimpleTestCase, TestCase, TransactionTestCase
+from django.test import Client, TestCase
import troggle.settings as settings
-from troggle.core.models.survex import Wallet
+from troggle.core.models.wallets import Wallet
from troggle.core.models.troggle import Expedition
@@ -112,14 +110,13 @@ class PostTests(TestCase):
identified in the wallet
"""
c = self.client
- w = self.wallet
from django.contrib.auth.models import User
u = User.objects.get(username="expotest")
testyear = self.testyear
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
with open("core/fixtures/test_upload_file.txt", "r") as testf:
response = self.client.post(
@@ -162,7 +159,7 @@ class PostTests(TestCase):
u = User.objects.get(username="expotest")
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
with open("core/fixtures/test_upload_file.txt", "r") as testf:
response = self.client.post(
@@ -199,7 +196,7 @@ class PostTests(TestCase):
u = User.objects.get(username="expotest")
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
rename = "RENAMED-FILE.JPG"
with open("core/fixtures/test_upload_file.txt", "r") as testf:
@@ -231,7 +228,7 @@ class PostTests(TestCase):
u = User.objects.get(username="expotest")
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
response = self.client.post("/photoupload/", data={"photographer": "GussieFinkNottle"})
content = response.content.decode()
@@ -257,7 +254,7 @@ class PostTests(TestCase):
u = User.objects.get(username="expotest")
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
with open("core/fixtures/test_upload_file.pdf", "r") as testf:
response = self.client.post(
@@ -279,7 +276,7 @@ class PostTests(TestCase):
u = User.objects.get(username="expotest")
self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE")
- logged_in = c.login(username=u.username, password="secretword")
+ c.login(username=u.username, password="secretword")
with open("core/fixtures/test_upload_nosuffix", "r") as testf:
response = self.client.post(
@@ -383,7 +380,6 @@ class ComplexLoginTests(TestCase):
self.assertIsNotNone(t, "Logged in as '" + u.username + "' but failed to get the Troggle Admin page")
def test_noinfo_login(self):
- from django.contrib.auth.models import User
c = self.client # inherited from TestCase
u = self.user
@@ -401,7 +397,6 @@ class ComplexLoginTests(TestCase):
self.assertIsNotNone(t, "Logged in as '" + u.username + "' but failed to get /noinfo/ content")
def test_user_force(self):
- from django.conf import settings
c = self.client
u = self.user