diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-05-10 13:18:14 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-05-10 13:18:14 +0200 |
| commit | cd5019305db965b4e3acb028ec1f1524d0199917 (patch) | |
| tree | 798318aee35661a8e3d07da5e3b4e8a992d32052 /wrappers | |
| parent | 9e3e7f22892c3504e6de9827af0fabd9b4b098ea (diff) | |
Python: Add config retrieval test
Diffstat (limited to 'wrappers')
| -rw-r--r-- | wrappers/python/Makefile | 2 | ||||
| -rw-r--r-- | wrappers/python/tests.py | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/wrappers/python/Makefile b/wrappers/python/Makefile index 92482a4..22e9144 100644 --- a/wrappers/python/Makefile +++ b/wrappers/python/Makefile @@ -14,7 +14,7 @@ pack: test: .try-build-lib install "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_FILE)" -Dt "eduvpncommon/lib" - #python3 -m unittest test_discovery + python3 -m unittest tests rm eduvpncommon/lib/* clean: diff --git a/wrappers/python/tests.py b/wrappers/python/tests.py new file mode 100644 index 0000000..f006646 --- /dev/null +++ b/wrappers/python/tests.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import unittest +import eduvpncommon.main as eduvpn +import webbrowser +import sys +import os + +# Import project root directory where the selenium python utility is +sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + +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): + 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}") + +if __name__ == "__main__": + unittest.main() |
