[tests] Dummy compose is no longer private

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-22 15:58:34 +01:00
parent 385b52041c
commit e9292fc942
6 changed files with 37 additions and 37 deletions

View File

@ -17,7 +17,7 @@ class PungiTestCase(unittest.TestCase):
shutil.rmtree(self.topdir)
class _DummyCompose(object):
class DummyCompose(object):
def __init__(self, topdir, config):
self.supported = True
self.compose_date = '20151203'

View File

@ -11,10 +11,10 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.phases.buildinstall import BuildinstallPhase, BuildinstallThread
from tests.helpers import _DummyCompose, PungiTestCase
from tests.helpers import DummyCompose, PungiTestCase
class BuildInstallCompose(_DummyCompose):
class BuildInstallCompose(DummyCompose):
def __init__(self, *args, **kwargs):
super(BuildInstallCompose, self).__init__(*args, **kwargs)
self.variants = {

View File

@ -11,14 +11,14 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread
from tests.helpers import _DummyCompose, PungiTestCase
from tests.helpers import DummyCompose, PungiTestCase
class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Client|Server$': [
{
@ -100,7 +100,7 @@ class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build_filter_all_variants(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Client|Server$': [
{
@ -131,7 +131,7 @@ class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build_set_install_tree(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Server$': [
{
@ -191,7 +191,7 @@ class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build_set_extra_repos(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Server$': [
{
@ -252,7 +252,7 @@ class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build_create_release(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Server$': [
{
@ -288,7 +288,7 @@ class TestImageBuildPhase(PungiTestCase):
@mock.patch('pungi.phases.image_build.ThreadPool')
def test_image_build_scratch_build(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'image_build': {
'^Server$': [
{
@ -329,7 +329,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.image_build.KojiWrapper')
@mock.patch('pungi.phases.image_build.Linker')
def test_process(self, Linker, KojiWrapper, get_file_size, get_mtime):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji'
})
pool = mock.Mock()
@ -441,7 +441,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.image_build.KojiWrapper')
@mock.patch('pungi.phases.image_build.Linker')
def test_process_handle_fail(self, Linker, KojiWrapper):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [
('^.*$', {
@ -492,7 +492,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.image_build.KojiWrapper')
@mock.patch('pungi.phases.image_build.Linker')
def test_process_handle_exception(self, Linker, KojiWrapper):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [
('^.*$', {

View File

@ -13,13 +13,13 @@ import shutil
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.phases.image_checksum import ImageChecksumPhase, dump_checksums
from tests.helpers import _DummyCompose, PungiTestCase
from tests.helpers import DummyCompose, PungiTestCase
class TestImageChecksumPhase(PungiTestCase):
def test_config_skip_individual_with_multiple_algorithms(self):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'media_checksums': ['md5', 'sha1'],
'media_checksum_one_file': True
})
@ -32,7 +32,7 @@ class TestImageChecksumPhase(PungiTestCase):
@mock.patch('kobo.shortcuts.compute_file_checksums')
@mock.patch('pungi.phases.image_checksum.dump_checksums')
def test_checksum_one_file(self, dump, cc, exists):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'media_checksums': ['sha256'],
'media_checksum_one_file': True,
})
@ -52,7 +52,7 @@ class TestImageChecksumPhase(PungiTestCase):
@mock.patch('kobo.shortcuts.compute_file_checksums')
@mock.patch('pungi.phases.image_checksum.dump_checksums')
def test_checksum_save_individuals(self, dump, cc, exists):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'media_checksums': ['md5', 'sha256'],
})
@ -83,7 +83,7 @@ class TestImageChecksumPhase(PungiTestCase):
@mock.patch('kobo.shortcuts.compute_file_checksums')
@mock.patch('pungi.phases.image_checksum.dump_checksums')
def test_checksum_one_file_custom_name(self, dump, cc, exists):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'media_checksums': ['sha256'],
'media_checksum_one_file': True,
'media_checksum_base_filename': '%(release_short)s-%(variant)s-%(version)s-%(date)s%(type_suffix)s.%(respin)s'
@ -106,7 +106,7 @@ class TestImageChecksumPhase(PungiTestCase):
@mock.patch('kobo.shortcuts.compute_file_checksums')
@mock.patch('pungi.phases.image_checksum.dump_checksums')
def test_checksum_save_individuals_custom_name(self, dump, cc, exists):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'media_checksums': ['md5', 'sha256'],
'media_checksum_base_filename': '%(release_short)s-%(variant)s-%(version)s-%(date)s%(type_suffix)s.%(respin)s'
})

View File

@ -11,14 +11,14 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.phases.live_images import LiveImagesPhase, CreateLiveImageThread
from tests.helpers import _DummyCompose, PungiTestCase
from tests.helpers import DummyCompose, PungiTestCase
class TestLiveImagesPhase(PungiTestCase):
@mock.patch('pungi.phases.live_images.ThreadPool')
def test_live_image_build(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_images': [
('^Client$', {
'amd64': {
@ -61,7 +61,7 @@ class TestLiveImagesPhase(PungiTestCase):
@mock.patch('pungi.phases.live_images.ThreadPool')
def test_live_image_build_without_rename(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_images_no_rename': True,
'live_images': [
('^Client$', {
@ -105,7 +105,7 @@ class TestLiveImagesPhase(PungiTestCase):
@mock.patch('pungi.phases.live_images.ThreadPool')
def test_live_image_build_two_images(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_images': [
('^Client$', {
'amd64': [{
@ -171,7 +171,7 @@ class TestLiveImagesPhase(PungiTestCase):
@mock.patch('pungi.phases.live_images.ThreadPool')
@mock.patch('pungi.phases.live_images.resolve_git_url')
def test_spin_appliance(self, resolve_git_url, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_images': [
('^Client$', {
'amd64': {
@ -225,7 +225,7 @@ class TestCreateLiveImageThread(PungiTestCase):
@mock.patch('pungi.phases.live_images.run')
@mock.patch('pungi.phases.live_images.KojiWrapper')
def test_process(self, KojiWrapper, run, copy2, Image):
compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'})
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
pool = mock.Mock()
cmd = {
'ks_file': '/path/to/ks_file',
@ -303,7 +303,7 @@ class TestCreateLiveImageThread(PungiTestCase):
@mock.patch('pungi.phases.live_images.run')
@mock.patch('pungi.phases.live_images.KojiWrapper')
def test_process_no_rename(self, KojiWrapper, run, copy2, Image):
compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'})
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
pool = mock.Mock()
cmd = {
'ks_file': '/path/to/ks_file',
@ -382,7 +382,7 @@ class TestCreateLiveImageThread(PungiTestCase):
@mock.patch('pungi.phases.live_images.run')
@mock.patch('pungi.phases.live_images.KojiWrapper')
def test_process_applicance(self, KojiWrapper, run, copy2, Image):
compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'})
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
pool = mock.Mock()
cmd = {
'ks_file': '/path/to/ks_file',
@ -460,7 +460,7 @@ class TestCreateLiveImageThread(PungiTestCase):
@mock.patch('pungi.phases.live_images.run')
@mock.patch('pungi.phases.live_images.KojiWrapper')
def test_process_handles_fail(self, KojiWrapper, run, copy2):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [('^.+$', {'*': ['live']})],
})
@ -497,7 +497,7 @@ class TestCreateLiveImageThread(PungiTestCase):
@mock.patch('pungi.phases.live_images.run')
@mock.patch('pungi.phases.live_images.KojiWrapper')
def test_process_handles_exception(self, KojiWrapper, run, copy2):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [('^.+$', {'*': ['live']})],
})

View File

@ -10,13 +10,13 @@ import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread
from tests.helpers import _DummyCompose, PungiTestCase
from tests.helpers import DummyCompose, PungiTestCase
class TestLiveMediaPhase(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.ThreadPool')
def test_live_media_minimal(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_media': {
'^Server$': [
{
@ -56,7 +56,7 @@ class TestLiveMediaPhase(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.ThreadPool')
def test_live_media_non_existing_install_tree(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_media': {
'^Server$': [
{
@ -79,7 +79,7 @@ class TestLiveMediaPhase(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.ThreadPool')
def test_live_media_non_existing_repo(self, ThreadPool):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_media': {
'^Server$': [
{
@ -103,7 +103,7 @@ class TestLiveMediaPhase(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.resolve_git_url')
@mock.patch('pungi.phases.livemedia_phase.ThreadPool')
def test_live_media_full(self, ThreadPool, resolve_git_url):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'live_media': {
'^Server$': [
{
@ -161,7 +161,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.KojiWrapper')
@mock.patch('pungi.phases.livemedia_phase.Linker')
def test_process(self, Linker, KojiWrapper, get_file_size, get_mtime):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji'
})
config = {
@ -258,7 +258,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.KojiWrapper')
def test_handle_koji_fail(self, KojiWrapper):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [
('^.+$', {'*': ['live-media']})
@ -297,7 +297,7 @@ class TestCreateImageBuildThread(PungiTestCase):
@mock.patch('pungi.phases.livemedia_phase.KojiWrapper')
def test_handle_exception(self, KojiWrapper):
compose = _DummyCompose(self.topdir, {
compose = DummyCompose(self.topdir, {
'koji_profile': 'koji',
'failable_deliverables': [
('^.+$', {'*': ['live-media']})