diff options
author | zsloan | 2020-07-24 20:16:17 -0500 |
---|---|---|
committer | GitHub | 2020-07-24 20:16:17 -0500 |
commit | f66da35a09cbb8da13cfb142cbe3ff208404970b (patch) | |
tree | b05021c6e7b9f83c63257fec63414ecefa36668e /test/unittest | |
parent | 60d8968c4fc2ca15fc9cf2f63c0b34a25f6fb053 (diff) | |
parent | 5eb26c5a209f3a3c54cf6fe623e5372188bdd1bc (diff) | |
download | genenetwork2-f66da35a09cbb8da13cfb142cbe3ff208404970b.tar.gz |
Merge pull request #409 from BonfaceKilz/Build/add-tests
Build/add tests
Diffstat (limited to 'test/unittest')
-rw-r--r-- | test/unittest/__init__.py | 0 | ||||
-rw-r--r-- | test/unittest/base/__init__.py | 0 | ||||
-rw-r--r-- | test/unittest/base/test_general_object.py | 21 | ||||
-rw-r--r-- | test/unittest/test_registration.py | 27 |
4 files changed, 21 insertions, 27 deletions
diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/unittest/__init__.py diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/unittest/base/__init__.py diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py new file mode 100644 index 00000000..699cb079 --- /dev/null +++ b/test/unittest/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from base.GeneralObject import GeneralObject + + +class TestGeneralObjectTests(unittest.TestCase): + """ + Test the GeneralObject base class + """ + + def test_object_contents(self): + """Test whether base contents are stored properly""" + test_obj = GeneralObject("a", "b", "c") + self.assertEqual("abc", ''.join(test_obj.contents)) + + def test_object_dict(self): + """Test whether the base class is printed properly""" + test_obj = GeneralObject("a", name="test", value=1) + self.assertEqual(str(test_obj), "value = 1\nname = test\n") + self.assertEqual( + repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n") diff --git a/test/unittest/test_registration.py b/test/unittest/test_registration.py deleted file mode 100644 index 98d0cdff..00000000 --- a/test/unittest/test_registration.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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() |