def test_set_immutable_property_now_not_in_cert(self): existing_repo = Repo('testrepo') existing_repo['proxy_username'] = "******" incoming_repo = {} existing_repo.update(incoming_repo) # Immutable properties should be always be added/updated, # and removed if undefined in the new repo definition. self.assertFalse("proxy_username" in existing_repo.keys())
def test_set_mutable_property_now_empty_value(self): existing_repo = Repo('testrepo') existing_repo['metadata_expire'] = "blah" incoming_repo = {'metadata_expire': ''} existing_repo.update(incoming_repo) # re comments in repolib # Mutable properties should be added if not currently defined, # otherwise left alone. self.assertTrue("metadata_expire" in existing_repo.keys())
def test_set_immutable_property_now_empty(self): existing_repo = Repo('testrepo') existing_repo['proxy_username'] = "******" incoming_repo = {} existing_repo.update(incoming_repo) self.assertFalse("proxy_username" in existing_repo.keys())
def test_unset_immutable_property(self): existing_repo = Repo('testrepo') incoming_repo = {'name': "woof"} existing_repo.update(incoming_repo) self.assertEqual("woof", existing_repo['name'])
def test_unset_mutable_property(self): existing_repo = Repo('testrepo') incoming_repo = {'metadata_expire': 2000} existing_repo.update(incoming_repo) self.assertEqual(2000, existing_repo['metadata_expire'])
def test_mutable_property_in_repo_but_not_in_cert(self): existing_repo = Repo('testrepo') existing_repo['metadata_expire'] = 1000 incoming_repo = {} existing_repo.update(incoming_repo) self.assertEqual(1000, existing_repo['metadata_expire'])
def test_gpgcheck_is_mutable(self): existing_repo = Repo('testrepo') existing_repo['gpgcheck'] = "0" incoming_repo = {'gpgcheck': "1"} existing_repo.update(incoming_repo) self.assertEqual("0", existing_repo['gpgcheck'])
def test_empty_strings_not_set_in_file(self): r = Repo('testrepo', (('proxy', ""), )) r['proxy'] = "" self.assertFalse(("proxy", "") in r.items()) r.update({"proxy": ""}) self.assertFalse(("proxy", "") in r.items())