def setUp(self): self.mox = mox.Mox() self.logger_stub = stubs.LoggerStub() self.messenger_stub = stubs.MessengerStub() self.error_mgr_mock = self.mox.CreateMock( checkpkg_lib.SetCheckInterface) self.pkg_data = copy.deepcopy(tree_stats[0])
def setUp(self): super(TestLibraries, self).setUp() self.logger_stub = stubs.LoggerStub() self.messenger_stub = stubs.MessengerStub() self.error_mgr_mock = self.mox.CreateMock( checkpkg_lib.SetCheckInterface) self.pkg_data = copy.deepcopy(sudo_stats[0])
def testDodgyCall(self): paths_to_verify = set( ['/opt/csw/bin', '/opt/csw/bin/bar', '/opt/csw/lib', '/opt/csw/lib/libfoo.so.1']) pkg_by_path = {'/opt/csw/bin/bar': ['CSWbar'], '/opt/csw/lib/libfoo.so.1': ['CSWbar']} self.mox = mox.Mox() self.error_mgr_mock = self.mox.CreateMock( checkpkg_lib.SetCheckInterface) self.error_mgr_mock.GetPkgByPath('/opt/csw/lib').AndReturn(["CSWcommon"]) self.error_mgr_mock.GetPkgByPath('/opt/csw/bin').AndReturn(["CSWcommon"]) self.mox.ReplayAll() logger_stub = stubs.LoggerStub() expected = { '/opt/csw/bin': [u'CSWcommon'], '/opt/csw/bin/bar': ['CSWbar'], '/opt/csw/lib': [u'CSWcommon'], '/opt/csw/lib/libfoo.so.1': ['CSWbar']} self.assertEqual( expected, dependency_checks.GetPkgByFullPath(self.error_mgr_mock, logger_stub, paths_to_verify, pkg_by_path)) self.mox.VerifyAll()
def testOneCall(self): path_list = ["/foo", "/foo/bar"] pkg_by_path = {"/foo": ["CSWfoo"]} expected = {'/foo': ['CSWfoo'], '/foo/bar': ['CSWbar']} self.mox = mox.Mox() self.error_mgr_mock = self.mox.CreateMock( checkpkg_lib.SetCheckInterface) self.error_mgr_mock.GetPkgByPath('/foo/bar').AndReturn(["CSWbar"]) self.mox.ReplayAll() logger_stub = stubs.LoggerStub() self.assertEqual( expected, dependency_checks.GetPkgByFullPath(self.error_mgr_mock, logger_stub, path_list, pkg_by_path)) self.mox.VerifyAll()