def test_copy(self): b_orig = Modulemd.Buildopts() b = b_orig.copy() assert b assert b.props.rpm_macros is None assert b.get_rpm_macros() is None assert b.get_rpm_whitelist() == [] assert b.get_arches() == [] b.add_rpm_to_whitelist("test2") b.add_rpm_to_whitelist("test3") b.add_rpm_to_whitelist("test1") b.add_arch("x86_64") b.add_arch("ppc64le") b = b_orig.copy() assert b # make sure lists added to b above got clobbered by copy assert b.get_rpm_whitelist() == [] assert b.get_arches() == [] b_orig.set_rpm_macros("Test macros") b_orig.add_rpm_to_whitelist("test2") b_orig.add_rpm_to_whitelist("test3") b_orig.add_rpm_to_whitelist("test1") b_orig.add_arch("x86_64") b_orig.add_arch("ppc64le") b = b_orig.copy() assert b assert b.props.rpm_macros == "Test macros" assert b.get_rpm_macros() == "Test macros" assert b.get_rpm_whitelist() == ["test1", "test2", "test3"] assert b.get_arches() == ["ppc64le", "x86_64"]
def test_constructor(self): # Test that the new() function works b = Modulemd.Buildopts.new() assert b assert b.props.rpm_macros is None assert b.get_rpm_macros() is None assert b.get_rpm_whitelist() == [] # Test that init works with rpm_macros b = Modulemd.Buildopts(rpm_macros='Test macros') assert b assert b.props.rpm_macros == 'Test macros' assert b.get_rpm_macros() == 'Test macros' assert b.get_rpm_whitelist() == []
def test_buildopts(self): for version in modulestream_versions: stream = Modulemd.ModuleStream.new(version) # Check the defaults assert stream.props.buildopts is None assert stream.get_buildopts() is None buildopts = Modulemd.Buildopts() buildopts.props.rpm_macros = "%demomacro 1" stream.set_buildopts(buildopts) assert stream.props.buildopts is not None assert stream.props.buildopts is not None assert stream.props.buildopts.props.rpm_macros == "%demomacro 1"
def test_whitelist(self): b = Modulemd.Buildopts() assert b.get_rpm_whitelist() == [] b.add_rpm_to_whitelist('test2') assert b.get_rpm_whitelist() == ['test2'] b.add_rpm_to_whitelist('test3') b.add_rpm_to_whitelist('test1') assert b.get_rpm_whitelist() == ['test1', 'test2', 'test3'] b.add_rpm_to_whitelist('test2') assert b.get_rpm_whitelist() == ['test1', 'test2', 'test3'] b.remove_rpm_from_whitelist('test1') assert b.get_rpm_whitelist() == ['test2', 'test3']
def test_get_set_rpm_macros(self): b = Modulemd.Buildopts() assert b.props.rpm_macros is None assert b.get_rpm_macros() is None b.set_rpm_macros('foobar') assert b.props.rpm_macros == 'foobar' assert b.get_rpm_macros() == 'foobar' b.props.rpm_macros = 'barfoo' assert b.props.rpm_macros == 'barfoo' assert b.get_rpm_macros() == 'barfoo' b.props.rpm_macros = None assert b.props.rpm_macros is None assert b.get_rpm_macros() is None
def test_get_set_rpm_macros(self): b = Modulemd.Buildopts() assert b.props.rpm_macros is None assert b.get_rpm_macros() is None b.set_rpm_macros("foobar") assert b.props.rpm_macros == "foobar" assert b.get_rpm_macros() == "foobar" b.props.rpm_macros = "barfoo" assert b.props.rpm_macros == "barfoo" assert b.get_rpm_macros() == "barfoo" b.props.rpm_macros = None assert b.props.rpm_macros is None assert b.get_rpm_macros() is None
def test_copy(self): b_orig = Modulemd.Buildopts() b = b_orig.copy() assert b assert b.props.rpm_macros is None assert b.get_rpm_macros() is None assert b.get_rpm_whitelist() == [] b_orig.set_rpm_macros('Test macros') b.add_rpm_to_whitelist('test2') b.add_rpm_to_whitelist('test3') b.add_rpm_to_whitelist('test1') b = b_orig.copy() assert b assert b.props.rpm_macros == 'Test macros' assert b.get_rpm_macros() == 'Test macros' assert b.get_rpm_whitelist() == ['test1', 'test2', 'test3']
def test_arches(self): b = Modulemd.Buildopts() assert b.get_arches() == [] b.add_arch("s390x") assert b.get_arches() == ["s390x"] b.add_arch("x86_64") b.add_arch("ppc64le") assert b.get_arches() == ["ppc64le", "s390x", "x86_64"] b.add_arch("s390x") assert b.get_arches() == ["ppc64le", "s390x", "x86_64"] b.remove_arch("ppc64le") assert b.get_arches() == ["s390x", "x86_64"] b.clear_arches() assert b.get_arches() == []
def test_whitelist(self): b = Modulemd.Buildopts() assert b.get_rpm_whitelist() == [] b.add_rpm_to_whitelist("test2") assert b.get_rpm_whitelist() == ["test2"] b.add_rpm_to_whitelist("test3") b.add_rpm_to_whitelist("test1") assert b.get_rpm_whitelist() == ["test1", "test2", "test3"] b.add_rpm_to_whitelist("test2") assert b.get_rpm_whitelist() == ["test1", "test2", "test3"] b.remove_rpm_from_whitelist("test1") assert b.get_rpm_whitelist() == ["test2", "test3"] b.clear_rpm_whitelist() assert b.get_rpm_whitelist() == []