pungi/tests/test_lorax_wrapper.py
Lubomír Sedlář 8d224b206b [atomic] Add atomic_installer phase
This phase runs lorax with extra templates in Koji runroot task, links
the boot.iso to proper location in compose directory and adds the
installer iso to image manifest. This phase runs concurrently with live
media etc.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2016-03-23 12:00:06 +01:00

61 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import unittest
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.wrappers.lorax import LoraxWrapper
class LoraxWrapperTest(unittest.TestCase):
def setUp(self):
self.lorax = LoraxWrapper()
def test_get_command_with_minimal_arguments(self):
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
"/mnt/repo_baseurl", "/mnt/output_dir")
self.assertEqual(cmd[0], 'lorax')
self.assertItemsEqual(cmd[1:],
['--product=product',
'--version=version',
'--release=release',
'--source=file:///mnt/repo_baseurl',
'/mnt/output_dir'])
def test_get_command_with_all_arguments(self):
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
"/mnt/repo_baseurl", "/mnt/output_dir",
variant="Server", bugurl="http://example.com/",
nomacboot=True, noupgrade=True, is_final=True,
buildarch='x86_64', volid='VOLUME_ID',
buildinstallpackages=['bash', 'vim'],
add_template=['t1', 't2'],
add_arch_template=['ta1', 'ta2'],
add_template_var=['v1', 'v2'],
add_arch_template_var=['va1', 'va2'])
self.assertEqual(cmd[0], 'lorax')
self.assertItemsEqual(cmd[1:],
['--product=product', '--version=version',
'--release=release', '--variant=Server',
'--source=file:///mnt/repo_baseurl',
'--bugurl=http://example.com/',
'--buildarch=x86_64', '--volid=VOLUME_ID',
'--nomacboot', '--noupgrade', '--isfinal',
'--installpkgs=bash', '--installpkgs=vim',
'--add-template=t1', '--add-template=t2',
'--add-arch-template=ta1', '--add-arch-template=ta2',
'--add-template-var=v1', '--add-template-var=v2',
'--add-arch-template-var=va1', '--add-arch-template-var=va2',
'/mnt/output_dir'])
if __name__ == "__main__":
unittest.main()