Nir Soffer has uploaded a new change for review. Change subject: tests: Move securable tests to its own test module ......................................................................
tests: Move securable tests to its own test module The tests were hidden in tests/main.py making it harder to find the tests. Change-Id: I40fad51de67ad732d9a91119010a6bf889af6bc7 Signed-off-by: Nir Soffer <nsof...@redhat.com> --- M tests/Makefile.am M tests/main.py 2 files changed, 1 insertion(+), 67 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/24482/1 diff --git a/tests/Makefile.am b/tests/Makefile.am index 44d4923..b7105ba 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -61,6 +61,7 @@ remoteFileHandlerTests.py \ resourceManagerTests.py \ schemaTests.py \ + securableTests.py \ sslTests.py \ storageMailboxTests.py \ tcTests.py \ diff --git a/tests/main.py b/tests/main.py index e2237da..1f87092 100644 --- a/tests/main.py +++ b/tests/main.py @@ -23,76 +23,9 @@ from gluster import exception as gluster_exception from storage import storage_exception -from storage.securable import secured, SecureError, unsecured from vdsm.utils import GeneralException from testrunner import VdsmTestCase as TestCaseBase - - -class TestSecurable(TestCaseBase): - - @secured - class MySecureClass(object): - - def __init__(self): - self.secured = False - - def __is_secure__(self): - return self.secured - - def securedMethod(self): - "securedMethod docstring" - pass - - @unsecured - def unsecuredMethod(self): - "unsecuredMethod docstring" - pass - - class MyClassWithoutIsSecureMethod(object): - pass - - class MyClassIsSecureClassMethod(object): - - @classmethod - def __is_secure__(self): - pass - - def assertUnsecured(self, secureObject): - self.assertRaises(SecureError, secureObject.securedMethod) - secureObject.unsecuredMethod() - - def assertSecured(self, secureObject): - secureObject.securedMethod() - secureObject.unsecuredMethod() - - def testIsSecureMethodCheck(self): - self.assertRaises(NotImplementedError, secured, - TestSecurable.MyClassWithoutIsSecureMethod) - self.assertRaises(NotImplementedError, secured, - TestSecurable.MyClassIsSecureClassMethod) - - def testSecurable(self): - secureObject = TestSecurable.MySecureClass() - self.assertUnsecured(secureObject) - - secureObject.secured = True - self.assertSecured(secureObject) - - secureObject.secured = False - self.assertUnsecured(secureObject) - - def testSecurityOverride(self): - secureObject = TestSecurable.MySecureClass() - secureObject.securedMethod(__securityOverride=True) - - def testDocstringWrapping(self): - secureObject = TestSecurable.MySecureClass() - - self.assertEqual(secureObject.securedMethod.__doc__, - "securedMethod docstring") - self.assertEqual(secureObject.unsecuredMethod.__doc__, - "unsecuredMethod docstring") class TestStorageExceptions(TestCaseBase): -- To view, visit http://gerrit.ovirt.org/24482 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I40fad51de67ad732d9a91119010a6bf889af6bc7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches