aboutsummaryrefslogtreecommitdiff
path: root/test/requests/test_registration.py
diff options
context:
space:
mode:
authorPjotr Prins2018-03-19 10:52:28 +0100
committerGitHub2018-03-19 10:52:28 +0100
commitb359cb0712e9ef923d35524f310d841581d48f30 (patch)
tree3c4cafc0bc0b481490674c807f279b4371130d0c /test/requests/test_registration.py
parent2602be69f2869de376d1b9ced6131d880e9476c2 (diff)
parent5ccf077f53c6546bb9258c7116b4b1cf8903375f (diff)
downloadgenenetwork2-b359cb0712e9ef923d35524f310d841581d48f30.tar.gz
Merge pull request #5 from fredmanglis/testing
Testing
Diffstat (limited to 'test/requests/test_registration.py')
-rw-r--r--test/requests/test_registration.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/requests/test_registration.py b/test/requests/test_registration.py
new file mode 100644
index 00000000..0047e8a6
--- /dev/null
+++ b/test/requests/test_registration.py
@@ -0,0 +1,41 @@
+import sys
+import requests
+from parametrized_test import ParametrizedTest
+
+class TestRegistration(ParametrizedTest):
+
+ def tearDown(self):
+ for item in self.es_cleanup:
+ self.es.delete(index="users", doc_type="local", id=item["_id"])
+
+ def testRegistrationPage(self):
+ if self.es.ping():
+ data = {
+ "email_address": "test@user.com",
+ "full_name": "Test User",
+ "organization": "Test Organisation",
+ "password": "test_password",
+ "password_confirm": "test_password"
+ }
+ requests.post(self.gn2_url+"/n/register", data)
+ response = self.es.search(
+ index="users"
+ , doc_type="local"
+ , body={
+ "query": {"match": {"email_address": "test@user.com"}}})
+ self.assertEqual(len(response["hits"]["hits"]), 1)
+ else:
+ self.skipTest("The elasticsearch server is down")
+
+def main(gn2, es):
+ import unittest
+ suite = unittest.TestSuite()
+ suite.addTest(TestRegistration(methodName="testRegistrationPage", gn2_url=gn2, es_url=es))
+ runner = unittest.TextTestRunner()
+ runner.run(suite)
+
+if __name__ == "__main__":
+ if len(sys.argv) < 3:
+ raise Exception("Required arguments missing")
+ else:
+ main(sys.argv[1], sys.argv[2])