diff --git a/debian/changelog b/debian/changelog index 238e72a378a5151993e243ea32cc901eceb639b6..80ada5bb2fd21632aa3dfd5a1736961976173254 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python3-sams-classes (1.0.3~1) UNRELEASED; urgency=medium + + * fixed issue #29 "Apps sollen mit Alias an Hub angemeldet werden können" + + -- Lobinger <slobinger@justus.zib.de> Thu, 22 Jun 2017 08:43:01 +0200 + python3-sams-classes (1.0.2) unstable; urgency=medium * fixed issue #27 "Proxy muss alle HTTP-Methoden unterstützen" diff --git a/sams_classes/sams_hub.py b/sams_classes/sams_hub.py index de08fbdcb7d30fa68d9a4c71597c1b8215c73af6..920428c9de5c1233592889c9fdd61230804fa6bc 100644 --- a/sams_classes/sams_hub.py +++ b/sams_classes/sams_hub.py @@ -30,7 +30,7 @@ class SAMSHub: self._flaskApp.context_processor(self._context_processor) self._flaskApp.secret_key = 'my awesome SAMSHub secret_key' - def addApp(self, app: SAMSApp = None): + def addApp(self, app: SAMSApp = None, alias = None): if not isinstance(app, SAMSApp): raise TypeError('Argument app has to be a SAMSApp.') self._apps[app.name] = app @@ -38,7 +38,7 @@ class SAMSHub: if app.name == self._config.get('main_app'): self._flaskApp.register_blueprint(app.blueprint) self._flaskApp.register_blueprint( - app.blueprint, url_prefix = '/' + app.name) + app.blueprint, url_prefix = '/' + (alias or app.name)) @property def appKeys(self): diff --git a/sams_classes/version.py b/sams_classes/version.py index 34c1db36a1731d4c38e5d0388cafcd3d8c5a0c8b..77139f6adeb4faadea412300c55d15cf702ed0d8 100644 --- a/sams_classes/version.py +++ b/sams_classes/version.py @@ -1 +1 @@ -__version__ = '1.0.2' \ No newline at end of file +__version__ = '1.0.3' \ No newline at end of file diff --git a/test/test_sams_hub.py b/test/test_sams_hub.py index ac6b12f0bfaaea09d7c2074035ab20326200fc45..673b5338b0e35413b8d2922cc555f74e83386572 100644 --- a/test/test_sams_hub.py +++ b/test/test_sams_hub.py @@ -33,12 +33,14 @@ class CaseSAMSHubWithThreadedAPI(unittest.TestCase): self.hub.addApp( SAMSApp(name = 'test',manifest = manifest, langDict={'de':{}}) ) - self.hub.addApp( - SAMSApp(name = 'test.app', manifest = manifest, langDict={'de':{}}) - ) + testApp = SAMSApp(name = 'test.app', manifest = manifest, langDict={'de':{}}) + self.hub.addApp(app = testApp) + self.hub.addApp(app = testApp, alias = 'test') with self.hub.flaskApp.test_client() as client: - self.assertIs(client.get(path='/api/hello').status_code, 200) - self.assertIs(client.get(path='/test.app/api/hello').status_code, 200) + for urlPrefix in ('', '/test.app', '/test'): + with self.subTest(urlPrefix): + self.assertIs(client.get( + path = urlPrefix + '/api/hello').status_code, 200) class CaseSAMSHubWithMainApp(unittest.TestCase):