aboutsummaryrefslogtreecommitdiff
path: root/test/unittest/test_registration.py
diff options
context:
space:
mode:
authorPjotr Prins2018-02-15 14:03:38 +0000
committerPjotr Prins2018-03-26 09:29:29 +0000
commite7f80eb6cf60bb117f943132049ec0b220ddcab4 (patch)
treef9e159e8cd182cb300f629040e5d0ba1e35b1b16 /test/unittest/test_registration.py
parent3de1ecfa37b73b4cb011b634c8b4afc2362f858c (diff)
downloadgenenetwork2-e7f80eb6cf60bb117f943132049ec0b220ddcab4.tar.gz
Added unittest example
Diffstat (limited to 'test/unittest/test_registration.py')
-rw-r--r--test/unittest/test_registration.py27
1 files changed, 27 insertions, 0 deletions
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()