diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-05-13 12:12:22 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-05-13 12:12:22 +0200 |
| commit | 5abf00ab87a55662eefc7716de52ead9749293c6 (patch) | |
| tree | 1cfa64b99482d7cc08b1d7da5d6833b75f5f7714 /wrappers/python/tests.py | |
| parent | 57d6c2ac55a5fd1ea609c873d5410174b7cf6ca4 (diff) | |
Refactor: Adapt the API to the documentation
Diffstat (limited to 'wrappers/python/tests.py')
| -rw-r--r-- | wrappers/python/tests.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/wrappers/python/tests.py b/wrappers/python/tests.py index f006646..60ed79e 100644 --- a/wrappers/python/tests.py +++ b/wrappers/python/tests.py @@ -13,20 +13,33 @@ from selenium_eduvpn import login_eduvpn class ConfigTests(unittest.TestCase): def testConfig(self): - self._eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", "testconfigs") - assert self._eduvpn.register() - @self._eduvpn.event.on("OAuth_Started", eduvpn.StateType.Enter) - def oauth_initialized(url): + _eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", "testconfigs") + # This can throw an exception + _eduvpn.register() + @_eduvpn.event.on("OAuth_Started", eduvpn.StateType.Enter) + def oauth_initialized(old_state, url): login_eduvpn(url) server_uri = os.getenv("SERVER_URI") if not server_uri: self.fail("No SERVER_URI environment variable given") - config, error = self._eduvpn.get_config_institute_access(server_uri) - - if error != "": - self.fail(f"Got error: {error} when connecting to {server_uri}") + # This can throw an exception + _eduvpn.get_config_institute_access(server_uri) + + # Deregister + _eduvpn.deregister() + + def testDoubleRegister(self): + _eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", "testconfigs") + # This can throw an exception + _eduvpn.register() + # This should throw + try: + _eduvpn.register() + except Exception as e: + return + self.fail("No exception thrown on second register") if __name__ == "__main__": unittest.main() |
