aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-02-16 07:19:58 +0300
committerMuriithi Frederick Muriuki2018-02-16 07:19:58 +0300
commit25e1c38af3a987e6ce2f3a90ddfeb5855dd0d746 (patch)
tree8026d9511aec117d4010f0498c3eebf0d1bd95e6 /test
parent1defefd05d0eb658fb5922fc755547261a5e914a (diff)
parent3a26e0fb7b88cd9c105a1f7e9ca9d5a8b2130d82 (diff)
downloadgenenetwork2-25e1c38af3a987e6ce2f3a90ddfeb5855dd0d746.tar.gz
Merge branch 'pjotrp-gn-testing-es' into testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/requests/test-website.py20
-rw-r--r--test/unittest/test_registration.py27
2 files changed, 47 insertions, 0 deletions
diff --git a/test/requests/test-website.py b/test/requests/test-website.py
new file mode 100755
index 00000000..d02b71aa
--- /dev/null
+++ b/test/requests/test-website.py
@@ -0,0 +1,20 @@
+# Run with something like
+#
+# env GN2_PROFILE=/home/wrk/opt/gn-latest ./bin/genenetwork2 ./etc/default_settings.py -c ../test/requests/test-website.py http://localhost:5003
+#
+# Mostly to pick up the Guix GN2_PROFILE and python modules
+
+import requests as req
+import sys
+
+print "Mechanical Rob firing up..."
+
+if len(sys.argv)<1:
+ raise "Problem with arguments"
+
+url = sys.argv[1]
+print url
+
+r = req.get(url)
+
+print r
diff --git a/test/unittest/test_registration.py b/test/unittest/test_registration.py
new file mode 100644
index 00000000..98d0cdff
--- /dev/null
+++ b/test/unittest/test_registration.py
@@ -0,0 +1,27 @@
+# Run test with something like
+#
+# env GN2_PROFILE=~/opt/gn-latest GENENETWORK_FILES=$HOME/gn2_data ./bin/genenetwork2 ./etc/default_settings.py -c ../test/unittest/test_registration.py
+#
+
+import unittest
+import mock.es_double as es
+from wqflask.user_manager import RegisterUser
+
+class TestRegisterUser(unittest.TestCase):
+ def setUp(self):
+ self.es = es.ESDouble()
+
+ def testRegisterUserWithCorrectData(self):
+ data = {
+ "email_address": "user@example.com"
+ , "full_name": "A.N. Other"
+ , "organization": "Some Organisation"
+ , "password": "testing"
+ , "password_confirm": "testing"
+ , "es_connection": self.es
+ }
+ result = RegisterUser(data)
+ self.assertEqual(len(result.errors), 0, "Errors were not expected")
+
+if __name__ == "__main__":
+ unittest.main()