def test_get_deb_child_condition(self): sp_version = DebianVersion('1-2') extra = {('pdk', 'sp-name'): 'one', ('pdk', 'sp-version'): sp_version} apache_deb = MockPackage('apache', '1', deb, 'sha-1:aaa', extra) expected = rules.ac([ rules.rc(eq, 'pdk', 'name', 'one'), rules.rc(eq, 'pdk', 'version', '1-2'), rules.rc(eq, 'pdk', 'type', 'dsc') ]) self.assert_equals(expected, get_deb_child_condition(apache_deb))
def test_get_child_condition(self): sp_version = DebianVersion('1-3') extra = {('pdk', 'sp-name'): 'apache', ('pdk', 'sp-version'): sp_version, ('deb', 'arch'): 'i386'} apache_deb = MockPackage('apache', '1-2', deb, 'sha-1:aaa', extra) ref_condition = rules.ac([rules.rc(eq, 'pdk', 'name', 'apache')]) apache_ref = PackageStanza(deb, 'sha-1:aaa', ref_condition, []) parent_condition = rules.ac([ apache_ref.reference.condition, rules.rc(eq, 'pdk', 'version', DebianVersion('1-2')) ]) child_condition = get_deb_child_condition(apache_deb) expected_rule = rules.oc([child_condition, parent_condition]) expected_key_info = ('pdk', 'name', 'apache') actual_rule, actual_key_info = get_child_condition(apache_deb, apache_ref) self.assert_equals(expected_rule, actual_rule) self.assert_equals(expected_key_info, actual_key_info)
def test_get_child_condition(self): sp_version = DebianVersion('1-3') extra = { ('pdk', 'sp-name'): 'apache', ('pdk', 'sp-version'): sp_version, ('deb', 'arch'): 'i386' } apache_deb = MockPackage('apache', '1-2', deb, 'sha-1:aaa', extra) ref_condition = rules.ac([rules.rc(eq, 'pdk', 'name', 'apache')]) apache_ref = PackageStanza(deb, 'sha-1:aaa', ref_condition, []) parent_condition = rules.ac([ apache_ref.reference.condition, rules.rc(eq, 'pdk', 'version', DebianVersion('1-2')) ]) child_condition = get_deb_child_condition(apache_deb) expected_rule = rules.oc([child_condition, parent_condition]) expected_key_info = ('pdk', 'name', 'apache') actual_rule, actual_key_info = get_child_condition( apache_deb, apache_ref) self.assert_equals(expected_rule, actual_rule) self.assert_equals(expected_key_info, actual_key_info)