2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 10:27:17 +00:00

ruf cleanup imports, bigly.

This commit is contained in:
2023-01-30 23:04:11 +00:00
parent e35fccea5d
commit 3aca0d0c76
29 changed files with 165 additions and 325 deletions

View File

@@ -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