Skip to content
Snippets Groups Projects

Resolve "static ordner je app ermöglichen"

Merged slobinger requested to merge 23-app-static-folder into master
1 file
+ 32
5
Compare changes
  • Side-by-side
  • Inline
+ 32
5
@@ -42,13 +42,15 @@ class CaseSAMSHubWithThreadedAPI(unittest.TestCase):
@@ -42,13 +42,15 @@ class CaseSAMSHubWithThreadedAPI(unittest.TestCase):
class CaseSAMSHubWithMainApp(unittest.TestCase):
class CaseSAMSHubWithMainApp(unittest.TestCase):
def test_main_app(self):
def setUp(self):
"""It is possible to declare a main app where the urls have no prefix"""
self.szenarios = [
szenarios = [
{'main_app': 'test', 'extra_app': 'test.app'},
{'main_app': 'test', 'extra_app': 'test.app'},
{'main_app': 'test.app', 'extra_app': 'test'}
{'main_app': 'test.app', 'extra_app': 'test'}
]
]
for szenario in szenarios:
 
def test_main_app(self):
 
"""It is possible to declare a main app where the urls have no prefix"""
 
for szenario in self.szenarios:
main_app = szenario['main_app']
main_app = szenario['main_app']
extra_app = szenario['extra_app']
extra_app = szenario['extra_app']
with self.subTest(main_app = main_app, extra_app = extra_app):
with self.subTest(main_app = main_app, extra_app = extra_app):
@@ -111,6 +113,31 @@ class CaseSAMSHubWithMainApp(unittest.TestCase):
@@ -111,6 +113,31 @@ class CaseSAMSHubWithMainApp(unittest.TestCase):
response = client.get(path)
response = client.get(path)
self.assertIs(response.status_code, 200)
self.assertIs(response.status_code, 200)
 
def test_static_files(self):
 
for szenario in self.szenarios:
 
main_app = szenario['main_app']
 
extra_app = szenario['extra_app']
 
hub = SAMSHub( name = 'test',
 
config = {'default_language': 'de', 'main_app' : ''.join(main_app)}
 
)
 
hub.addApp(
 
SAMSApp( name = main_app, manifest = {'default_language': 'de'},
 
langDict = {'de': {}}
 
)
 
)
 
hub.addApp(
 
SAMSApp( name = extra_app, manifest = {'default_language': 'de'},
 
langDict = {'de': {}}
 
)
 
)
 
hub.flaskApp.config['DEBUG'] = True
 
with self.subTest(main_app = main_app, extra_app = extra_app):
 
for static_url in ('/test/static/', '/test.app/static/'):
 
with hub.flaskApp.test_client(self) as client:
 
with self.subTest(static_url):
 
response = client.get(static_url + 'test.txt')
 
self.assertIs(response.status_code, 200)
 
class CaseSAMSHubInitExceptions(unittest.TestCase):
class CaseSAMSHubInitExceptions(unittest.TestCase):
def test_missing_init_name(self):
def test_missing_init_name(self):
Loading