summaryrefslogtreecommitdiff
path: root/wrappers/python/tests.py
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-10 13:18:14 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-10 13:18:14 +0200
commitcd5019305db965b4e3acb028ec1f1524d0199917 (patch)
tree798318aee35661a8e3d07da5e3b4e8a992d32052 /wrappers/python/tests.py
parent9e3e7f22892c3504e6de9827af0fabd9b4b098ea (diff)
Python: Add config retrieval test
Diffstat (limited to 'wrappers/python/tests.py')
-rw-r--r--wrappers/python/tests.py32
1 files changed, 32 insertions, 0 deletions
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()