コード例 #1
0
def test__init_img_file_not_qcow2():
    with mock.patch('f5_image_prep.ve_image_sync.os.path.isfile') as mock_file:
        mock_file.return_value = True
        with pytest.raises(ImageFileNotQcow2) as ex:
            veis(mock.MagicMock(), '/test/img', '/test')
        assert 'Image file given does not have the .qcow2 extension' == \
            ex.value.message
コード例 #2
0
def test__init_img_file_not_qcow2():
    with mock.patch('f5_image_prep.ve_image_sync.os.path.isfile') as mock_file:
        mock_file.return_value = True
        with pytest.raises(ImageFileNotQcow2) as ex:
            veis(mock.MagicMock(), '/test/img', '/test')
        assert 'Image file given does not have the .qcow2 extension' == \
            ex.value.message
コード例 #3
0
def VEImageSync():
    with mock.patch('f5_image_prep.ve_image_sync.os.path.isfile') as mock_file:
        mock_file.return_value = True
        return veis(
            mock.MagicMock(), '/test/img.qcow2',
            '/test.tar', False, '/test/'
        )
コード例 #4
0
def VEImageSync(request):
    from f5_image_prep.ve_image_sync import VEImageSync as veis

    def delete_image():
        GlanceLib(get_creds()).glance_client.images.delete(TEST_IMG.id)

    request.addfinalizer(delete_image)

    creds = get_creds()
    work_dir = sys.path[0]
    return veis(creds, BIGIPFILE, work_dir)
コード例 #5
0
def VEImageSync(request, set_env_vars, glanceclientmanager):
    from f5_image_prep.ve_image_sync import VEImageSync as veis
    set_env_vars

    def delete_image():
        glanceclientmanager.images.delete(TEST_IMG.id)

    request.addfinalizer(delete_image)

    creds = get_creds()
    work_dir = sys.path[0]
    return veis(creds, BIGIPFILE, STARTUP_SCRIPT, work_dir)
コード例 #6
0
def VEImageSync(request, set_env_vars, glanceclientmanager):
    from f5_image_prep.ve_image_sync import VEImageSync as veis
    set_env_vars

    def delete_image():
        glanceclientmanager.images.delete(TEST_IMG.id)

    request.addfinalizer(delete_image)

    creds = get_creds()
    work_dir = sys.path[0]
    return veis(creds, BIGIPFILE, STARTUP_SCRIPT, work_dir)
コード例 #7
0
def test__init__no_img_file():
    with mock.patch('f5_image_prep.ve_image_sync.os.path.isfile') as mock_file:
        mock_file.return_value = False
        with pytest.raises(LocalFileNonExtant) as ex:
            veis(mock.MagicMock(), '/test/img.qcow2', '/test/')
        assert 'Local file /test/img.qcow2 does not exist' in ex.value.message
コード例 #8
0
def test__init__no_img_file():
    with mock.patch('f5_image_prep.ve_image_sync.os.path.isfile') as mock_file:
        mock_file.return_value = False
        with pytest.raises(LocalFileNonExtant) as ex:
            veis(mock.MagicMock(), '/test/img.qcow2', '/test/')
        assert 'Local file /test/img.qcow2 does not exist' in ex.value.message