From 9b7781c9560af85b6ba3dec39971a55a80fa4691 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Jul 13 2016 14:28:46 +0000 Subject: Get the test suite working again. --- diff --git a/tests/test_hub/test_delete_build.py b/tests/test_hub/test_delete_build.py index 727f2ec..d6fc103 100644 --- a/tests/test_hub/test_delete_build.py +++ b/tests/test_hub/test_delete_build.py @@ -11,7 +11,7 @@ class TestDeleteBuild(unittest.TestCase): @mock.patch('kojihub.context') @mock.patch('kojihub.get_build') def test_delete_build_raise_error(self, build, context): - + context.session.assertPerm = mock.MagicMock() references = ['tags', 'rpms', 'archives', 'images'] for ref in references: context = mock.MagicMock() @@ -27,7 +27,7 @@ class TestDeleteBuild(unittest.TestCase): @mock.patch('kojihub.context') @mock.patch('kojihub.get_build') def test_delete_build_return_false(self, build, context): - + context.session.assertPerm = mock.MagicMock() references = ['tags', 'rpms', 'archives', 'images'] for ref in references: context = mock.MagicMock() @@ -42,7 +42,7 @@ class TestDeleteBuild(unittest.TestCase): @mock.patch('kojihub.context') @mock.patch('kojihub.get_build') def test_delete_build_check_last_used_raise_error(self, build, context): - + context.session.assertPerm = mock.MagicMock() references = ['tags', 'rpms', 'archives', 'images', 'last_used'] for ref in references: context = mock.MagicMock() @@ -59,7 +59,7 @@ class TestDeleteBuild(unittest.TestCase): @mock.patch('kojihub.context') @mock.patch('kojihub.get_build') def test_delete_build_check_last_used_raise_error(self, build, context): - + context.session.assertPerm = mock.MagicMock() references = ['tags', 'rpms', 'archives', 'images', 'last_used'] for ref in references: context = mock.MagicMock() diff --git a/tests/test_hub/test_import_image_internal.py b/tests/test_hub/test_import_image_internal.py index 287c172..212d368 100644 --- a/tests/test_hub/test_import_image_internal.py +++ b/tests/test_hub/test_import_image_internal.py @@ -22,6 +22,9 @@ class TestImportImageInternal(unittest.TestCase): @mock.patch('kojihub.Task') @mock.patch('kojihub.context') def test_basic(self, context, Task, get_build, get_archive_type, import_archive, work): + task = mock.MagicMock() + task.assertHost = mock.MagicMock() + Task.return_value = task imgdata = { 'arch': 'x86_64', 'task_id': 1, @@ -51,6 +54,9 @@ class TestImportImageInternal(unittest.TestCase): @mock.patch('kojihub.Task') @mock.patch('kojihub.context') def test_with_rpm(self, context, Task, get_build, get_archive_type, import_archive, build, work, get_rpm): + task = mock.MagicMock() + task.assertHost = mock.MagicMock() + Task.return_value = task rpm = { #'location': 'foo', 'id': 6, diff --git a/tests/test_hub/test_insert_processor.py b/tests/test_hub/test_insert_processor.py index 202d914..1771681 100644 --- a/tests/test_hub/test_insert_processor.py +++ b/tests/test_hub/test_insert_processor.py @@ -33,6 +33,7 @@ class TestInsertProcessor(unittest.TestCase): def test_make_create(self, context): cursor = mock.MagicMock() context.cnx.cursor.return_value = cursor + context.session.assertLogin = mock.MagicMock() proc = kojihub.InsertProcessor('sometable', data={'foo': 'bar'}) proc.make_create(event_id=1, user_id=2) self.assertEquals(proc.data['create_event'], 1) @@ -54,6 +55,7 @@ class TestInsertProcessor(unittest.TestCase): def test_dup_check(self, context): cursor = mock.MagicMock() context.cnx.cursor.return_value = cursor + context.session.assertLogin = mock.MagicMock() proc = kojihub.InsertProcessor('sometable', data={'foo': 'bar'}) proc.dup_check() diff --git a/tests/test_plugins/test_runroot_hub.py b/tests/test_plugins/test_runroot_hub.py index 97fd1cf..dd13289 100644 --- a/tests/test_plugins/test_runroot_hub.py +++ b/tests/test_plugins/test_runroot_hub.py @@ -8,6 +8,7 @@ class TestRunrootHub(unittest.TestCase): @mock.patch('kojihub.make_task') @mock.patch('runroot_hub.context') def test_basic_invocation(self, context, make_task): + context.session.assertPerm = mock.MagicMock() runroot_hub.runroot( tagInfo='some_tag', arch='x86_64',