forked from expo/troggle
git install test and tidying
This commit is contained in:
parent
36f92c5c9c
commit
252fcc4716
core/TESTS
@ -121,9 +121,11 @@ class SubprocessTest(TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def test_installs(self):
|
def test_installs(self):
|
||||||
|
''' Tests whether the external software is installed (but not whether it actually works)
|
||||||
|
'''
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
|
|
||||||
for i in [settings.CAVERN, settings.SURVEXPORT]:
|
for i in [settings.CAVERN, settings.SURVEXPORT, settings.GIT]:
|
||||||
# Define command as string and then split() into list format
|
# Define command as string and then split() into list format
|
||||||
cmd = f'which {i}'.split()
|
cmd = f'which {i}'.split()
|
||||||
try:
|
try:
|
||||||
|
@ -114,7 +114,7 @@ class PageTests(TestCase):
|
|||||||
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
|
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
|
||||||
|
|
||||||
def test_expoweb_notfound(self):
|
def test_expoweb_notfound(self):
|
||||||
response = self.client.get('/handbook/zyxxypqrqx.html')
|
response = self.client.get('/handbook/_test_zyxxypqrqx.html')
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 404)
|
||||||
ph = r'<h1>Page not found'
|
ph = r'<h1>Page not found'
|
||||||
@ -123,7 +123,7 @@ class PageTests(TestCase):
|
|||||||
|
|
||||||
def test_expoweb_no_dir(self):
|
def test_expoweb_no_dir(self):
|
||||||
# slash where there should not be one
|
# slash where there should not be one
|
||||||
response = self.client.get('/handbook/zyxxypqrqx/')
|
response = self.client.get('/handbook/_test_zyxxypqrqx/')
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
ph = r"<h1>Directory not found"
|
ph = r"<h1>Directory not found"
|
||||||
@ -357,7 +357,7 @@ class PageTests(TestCase):
|
|||||||
|
|
||||||
def test_page_photos_ok(self):
|
def test_page_photos_ok(self):
|
||||||
# Flat file tests.
|
# Flat file tests.
|
||||||
response = self.client.get('/photos/2018/PhilipSargent/corin.jpg')
|
response = self.client.get('/photos/2018/PhilipSargent/corin.jpg') #exists
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
if response.status_code != 302:
|
if response.status_code != 302:
|
||||||
@ -366,10 +366,10 @@ class PageTests(TestCase):
|
|||||||
|
|
||||||
def test_page_photos_not_ok(self):
|
def test_page_photos_not_ok(self):
|
||||||
# Flat file tests.
|
# Flat file tests.
|
||||||
response = self.client.get('/photos/2018/PhilipSargent/corin.jpeg')
|
response = self.client.get('/photos/2018/PhilipSargent/_corin.jpeg') # does not exist
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 404)
|
||||||
content = response.content.decode()
|
content = response.content.decode()
|
||||||
ph = r'<title>Page not found 2018/PhilipSargent/corin.jpeg</title>'
|
ph = r'<title>Page not found 2018/PhilipSargent/_corin.jpeg</title>'
|
||||||
phmatch = re.search(ph, content)
|
phmatch = re.search(ph, content)
|
||||||
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
|
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user