Skip to content

Commit

Permalink
removed /feedback/ from urls
Browse files Browse the repository at this point in the history
  • Loading branch information
4-dash committed Jan 2, 2025
1 parent 284e08d commit b8f38b3
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 98 deletions.
6 changes: 3 additions & 3 deletions src/feedback/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def suite():
suite.addTest(unittest.TestLoader().loadTestsFromName(test_module))
return suite

LOGIN_END = f'/{get_language()}/feedback/intern/'
INDEX_END = f'/{get_language()}/feedback/intern/uebersicht/'
AUTH_END = f'/{get_language()}/feedback/intern/auth_user/'
LOGIN_END = f'/{get_language()}/intern/'
INDEX_END = f'/{get_language()}/intern/uebersicht/'
AUTH_END = f'/{get_language()}/intern/auth_user/'
TESTSERVER_BEGIN = ''
LOGIN_URL = TESTSERVER_BEGIN+LOGIN_END
INDEX_URL = TESTSERVER_BEGIN+INDEX_END
Expand Down
2 changes: 1 addition & 1 deletion src/feedback/tests/test_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUp(self):
except OSError:
return self.skipTest("OSError while looking for pdflatex")

self.path = f'/{get_language()}/feedback/intern/generate_letters/'
self.path = f'/{get_language()}/intern/generate_letters/'
try:
self.orig_contents = self._get_erhebungswoche()
except IOError:
Expand Down
2 changes: 1 addition & 1 deletion src/feedback/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def test_veranstalter_url(self):
self.assertEqual(len(url_parts), 2)
ver_id = self.v[0].id
self.assertEqual(url_parts[0],
f'https://www.fachschaft.informatik.tu-darmstadt.de/{get_language()}/feedback/veranstalter/login/?vid={ver_id}')
f'https://www.fachschaft.informatik.tu-darmstadt.de/{get_language()}/veranstalter/login/?vid={ver_id}')
access_token = self.v[0].access_token
self.assertEqual('token=' + access_token, url_parts[1])
# FIXME: Is the below assert necessary? Since Python3 strings are all Unicode
Expand Down
24 changes: 12 additions & 12 deletions src/feedback/tests/test_views_intern.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUp(self):
self.s, self.v = get_veranstaltung('vu')

def test_close_order_bestellung_liegt_vor_post(self):
path = f'/{get_language()}/feedback/intern/status_final/'
path = f'/{get_language()}/intern/status_final/'
self.v.status = Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR
self.v.save()

Expand All @@ -36,7 +36,7 @@ def test_close_order_bestellung_liegt_vor_post(self):
self.assertEqual(self.v.status, Veranstaltung.STATUS_BESTELLUNG_WIRD_VERARBEITET)

def test_close_order_keine_evaluation_post(self):
path = f'/{get_language()}/feedback/intern/status_final/'
path = f'/{get_language()}/intern/status_final/'
self.v.status = Veranstaltung.STATUS_KEINE_EVALUATION
self.v.save()

Expand All @@ -47,7 +47,7 @@ def test_close_order_keine_evaluation_post(self):
self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL)

def test_close_order_status_angelegt_post(self):
path = f'/{get_language()}/feedback/intern/status_final/'
path = f'/{get_language()}/intern/status_final/'
self.v.status = Veranstaltung.STATUS_ANGELEGT
self.v.save()

Expand All @@ -58,7 +58,7 @@ def test_close_order_status_angelegt_post(self):
self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL)

def test_close_order_bestellung_geoeffnet_post(self):
path = f'/{get_language()}/feedback/intern/status_final/'
path = f'/{get_language()}/intern/status_final/'
self.v.status = Veranstaltung.STATUS_BESTELLUNG_GEOEFFNET
self.v.save()

Expand All @@ -69,7 +69,7 @@ def test_close_order_bestellung_geoeffnet_post(self):
self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL)

def test_close_order_refuse(self):
path = f'/{get_language()}/feedback/intern/status_final/'
path = f'/{get_language()}/intern/status_final/'
self.v.status = Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR
self.v.save()

Expand All @@ -93,7 +93,7 @@ def test_index(self):
self.assertEqual(response.context['cur_semester'], s)

def test_fragebogensprache(self):
path = f'/{get_language()}/feedback/intern/fragebogensprache/'
path = f'/{get_language()}/intern/fragebogensprache/'
self.do_non_su_test(path)
self.client.login(username='supers', password='pw')

Expand All @@ -103,7 +103,7 @@ def test_fragebogensprache(self):
self.assertEqual(response.templates[0].name, 'intern/fragebogensprache.html')

def test_export_veranstaltungen_get(self):
path = f'/{get_language()}/feedback/intern/export_veranstaltungen/'
path = f'/{get_language()}/intern/export_veranstaltungen/'
self.do_non_su_test(path)
self.client.login(username='supers', password='pw')

Expand All @@ -119,7 +119,7 @@ def checkXMLEqual(self, xml1, xml2):
self.assertEqual(xml1, xml2)

def test_export_veranstaltungen_post(self):
path = f'/{get_language()}/feedback/intern/export_veranstaltungen/'
path = f'/{get_language()}/intern/export_veranstaltungen/'
self.client.login(username='supers', password='pw')
self.client.login(username='supers', password='pw')

Expand Down Expand Up @@ -344,7 +344,7 @@ def test_export_veranstaltungen_post(self):


def test_export_veranstaltungen_post_primaerdozent(self):
path = f'/{get_language()}/feedback/intern/export_veranstaltungen/'
path = f'/{get_language()}/intern/export_veranstaltungen/'
self.client.login(username='supers', password='pw')

s, v = get_veranstaltung('v')
Expand Down Expand Up @@ -442,7 +442,7 @@ def test_export_veranstaltungen_post_primaerdozent(self):
class ImportErgebnisseTest(NonSuTestMixin, TestCase):
def setUp(self):
super(ImportErgebnisseTest, self).setUp()
self.path = f'/{get_language()}/feedback/intern/import_ergebnisse/'
self.path = f'/{get_language()}/intern/import_ergebnisse/'
self.s = Semester.objects.create(semester=20110, fragebogen='2009', sichtbarkeit='ADM')

def test_get(self):
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_post(self):
class SyncErgebnisseTest(NonSuTestMixin, TestCase):
def setUp(self):
super(SyncErgebnisseTest, self).setUp()
self.path = f'/{get_language()}/feedback/intern/sync_ergebnisse/'
self.path = f'/{get_language()}/intern/sync_ergebnisse/'
self.s, self.v = get_veranstaltung('v')

def test_get(self):
Expand Down Expand Up @@ -521,7 +521,7 @@ def test_post(self):


class SendmailTest(NonSuTestMixin, TestCase):
path = f'/{get_language()}/feedback/intern/sendmail/'
path = f'/{get_language()}/intern/sendmail/'

def test_get(self):
self.do_non_su_test(self.path)
Expand Down
8 changes: 4 additions & 4 deletions src/feedback/tests/test_views_intern_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_auth_user_post_missing_data(self):
self.assertContains(response, "Invalid Password or Username")

def test_rechte_uebernehmen(self):
path = f'/{get_language()}/feedback/intern/rechte_uebernehmen/'
path = f'/{get_language()}/intern/rechte_uebernehmen/'
self.do_non_su_test(path)

self.assertTrue(self.client.login(username='supers', password='pw'))
Expand All @@ -86,15 +86,15 @@ def test_rechte_uebernehmen(self):

def test_rechte_zuruecknehmen(self):
self.client.login(username='supers', password='pw')
self.client.post(f'/{get_language()}/feedback/intern/rechte_uebernehmen/', {'vid': self.v.id}, **{'REMOTE_USER': 'super'})
self.client.post(f'/{get_language()}/intern/rechte_uebernehmen/', {'vid': self.v.id}, **{'REMOTE_USER': 'super'})

response = self.client.get(f'/{get_language()}/feedback/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'})
response = self.client.get(f'/{get_language()}/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'})
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], tests.INDEX_URL)

def test_rechte_zuruecknehmen_no_origin_uid(self):
"""Es sollen rechte wiederhergestellt werden die vorher nicht abgegebn wurden"""
self.assertTrue(self.client.login(username='supers', password='pw'))
response = self.client.get(f'/{get_language()}/feedback/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'})
response = self.client.get(f'/{get_language()}/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'})
self.assertEqual(response.status_code, 302)
self.assertTrue(response['Location'].split('?')[0].endswith(tests.INDEX_END))
8 changes: 4 additions & 4 deletions src/feedback/tests/test_views_intern_vv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class InternVvTest(NonSuTestMixin):
def test_import_vv(self):
path = f'/{get_language()}/feedback/intern/import_vv/'
path = f'/{get_language()}/intern/import_vv/'
self.do_non_su_test(path)

self.assertTrue(self.client.login(username='supers', password='pw'))
Expand All @@ -33,7 +33,7 @@ def test_import_vv(self):
self.assertTrue(response['Location'].endswith('/intern/import_vv_edit/'))

def test_import_vv_edit_get(self):
path = f'/{get_language()}/feedback/intern/import_vv_edit/'
path = f'/{get_language()}/intern/import_vv_edit/'
self.do_non_su_test(path)

self.client.login(username='supers', password='pw')
Expand All @@ -58,7 +58,7 @@ def test_import_vv_edit_post(self):
iv1_sub = ImportVeranstaltung.objects.create(typ='vu', name='Bla II', category=ic_sub)

self.client.login(username='supers', password='pw')
path = f'/{get_language()}/feedback/intern/import_vv_edit/'
path = f'/{get_language()}/intern/import_vv_edit/'

# kein Semester angegeben
response = self.client.post(path, {'v': [iv0.id, iv1.id, iv1_sub.id]}, **{'REMOTE_USER': 'super'})
Expand All @@ -80,7 +80,7 @@ def test_import_vv_edit_post(self):
class InternVvEditUsersTest(NonSuTestMixin, TestCase):
def setUp(self):
super(InternVvEditUsersTest, self).setUp()
self.path = f'/{get_language()}/feedback/intern/import_vv_edit_users/'
self.path = f'/{get_language()}/intern/import_vv_edit_users/'

self.p0 = Person.objects.create(vorname='Je', nachname='Mand')
self.p1 = Person.objects.create(vorname='Auch Je', nachname='Mand')
Expand Down
42 changes: 21 additions & 21 deletions src/feedback/tests/test_views_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,33 @@ def setUp(self):

def test_unauth(self):
# von außerhalb des Uninetzes
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/')
response = self.client.get(f'/{get_language()}/ergebnisse/')
self.assertEqual(response.templates[0].name, 'public/unauth.html')

def test_normal(self):
# aus dem Uninetz ohne sichtbare Veranstaltungen (s1 nur für Admins)
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', **extra)
self.assertEqual(response.templates[0].name, 'public/keine_ergebnisse.html')

# aus dem Uninetz ohne sichtbare Veranstaltungen (s1 nur für Admins und Veranstalter)
self.s1.sichtbarkeit = 'VER'
self.s1.save()
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', **extra)
self.assertEqual(response.templates[0].name, 'public/keine_ergebnisse.html')

# aus dem Uninetz, s1 ist sichtbar
self.s1.sichtbarkeit = 'ALL'
self.s1.save()
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', **extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
self.assertEqual(response.context['semester'], self.s1)
self.assertSequenceEqual(response.context['semester_list'], [self.s1])

# aus dem Uninetz, s1 und s2 sind sichtbar
self.s0.sichtbarkeit = 'ALL'
self.s0.save()
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', **extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
self.assertEqual(ctx['semester'], self.s1)
Expand All @@ -85,7 +85,7 @@ def test_normal(self):
self.assertEqual(ctx['include_hidden'], False)

# GET-Parameter: nur semester (Semesterauswahl)
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', {'semester': self.s0.semester}, **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', {'semester': self.s0.semester}, **extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
self.assertEqual(ctx['semester'], self.s0)
Expand All @@ -96,7 +96,7 @@ def test_normal(self):
self.assertSequenceEqual(ctx['parts'], Ergebnis2009.parts)

# GET-Parameter: nur order
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', {'order': 'v_gesamt'}, **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', {'order': 'v_gesamt'}, **extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
self.assertEqual(ctx['semester'], self.s1)
Expand All @@ -107,7 +107,7 @@ def test_normal(self):
self.assertSequenceEqual(ctx['parts'], Ergebnis2009.parts)

# GET-Parameter: nur order (ungültig)
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', {'order': 'gibts_nicht'}, **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/', {'order': 'gibts_nicht'}, **extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
self.assertEqual(ctx['order'], 'alpha')
Expand All @@ -119,7 +119,7 @@ def test_normal(self):
self.v0.save()
self.v1.semester = self.s0
self.v1.save()
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/', {'semester': self.s0.semester, 'order': 'v_didaktik'},
response = self.client.get(f'/{get_language()}/ergebnisse/', {'semester': self.s0.semester, 'order': 'v_didaktik'},
**extra)
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
Expand All @@ -132,7 +132,7 @@ def test_normal(self):

def test_superuser(self):
self.client.login(username='testuser', password='secretpw')
response = self.client.get(f'/{get_language()}/feedback/intern/ergebnisse/')
response = self.client.get(f'/{get_language()}/intern/ergebnisse/')
self.assertEqual(response.templates[0].name, 'public/index.html')
ctx = response.context
self.assertEqual(ctx['semester'], self.s1)
Expand All @@ -156,34 +156,34 @@ def setUp(self):

def test_unauth(self):
# von außerhalb des Uninetzes
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/')
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/')
self.assertEqual(response.templates[0].name, 'public/unauth.html')

def test_nonexisting(self):
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/1337/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/1337/', **extra)
self.assertEqual(response.status_code, 404)
self.assertEqual(response.templates[0].name, '404.html')

def test_unsichtbar_adm(self):
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra)
self.assertEqual(response.status_code, 404)
self.assertEqual(response.templates[0].name, '404.html')

def test_unsichtbar_ver(self):
self.s.sichtbarkeit = 'VER'
self.s.save()
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra)
self.assertEqual(response.status_code, 404)
self.assertEqual(response.templates[0].name, '404.html')

def test_vu(self):
self.s.sichtbarkeit = 'ALL'
self.s.save()
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra)
ctx = response.context
self.assertEqual(ctx['v'], self.v)
with self.assertRaises(KeyError):
Expand All @@ -199,7 +199,7 @@ def test_v(self):
self.v.typ = 'v'
self.v.save()
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra)
ctx = response.context
self.assertEqual(ctx['v'], self.v)
self.assertEqual(ctx['parts'], list(zip(Ergebnis2009.parts_vl, list(self.e.values()))))
Expand All @@ -211,34 +211,34 @@ def test_kommentar(self):
p = Person.objects.create()
k = Kommentar.objects.create(veranstaltung=self.v, autor=p, text='Ganz ganz toll!')
extra = {'REMOTE_ADDR': '130.83.0.1'}
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **extra)
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra)
ctx = response.context
self.assertEqual(ctx['kommentar'], k)

def test_veranstalter_adm(self):
c = login_veranstalter(self.v)
response = c.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/')
response = c.get(f'/{get_language()}/ergebnisse/{self.v.id}/')
self.assertEqual(response.status_code, 404)
self.assertEqual(response.templates[0].name, '404.html')

def test_veranstalter_ver(self):
self.s.sichtbarkeit = 'VER'
self.s.save()
c = login_veranstalter(self.v)
response = c.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/')
response = c.get(f'/{get_language()}/ergebnisse/{self.v.id}/')
ctx = response.context
self.assertEqual(ctx['restricted'], True)

def test_superuser(self):
self.client.login(username='testuser', password='secretpw')
response = self.client.get(f'/{get_language()}/feedback/ergebnisse/{self.v.id}/', **{'REMOTE_USER':'testuser'})
response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **{'REMOTE_USER':'testuser'})
ctx = response.context
self.assertEqual(ctx['restricted'], True)


class PublicDropBarcode(TestCase):
def setUp(self):
self.path = f"/{get_language()}/feedback/barcodedrop/"
self.path = f"/{get_language()}/barcodedrop/"
self.barcode_scanner_no_access_right = BarcodeScanner.objects.create(token="LRh73Ds22", description="")

self.barcode_scanner = BarcodeScanner.objects.create(token="LRh73Ds23", description="")
Expand Down
Loading

0 comments on commit b8f38b3

Please sign in to comment.