def test_repo_update_forbidden_when_registered(self): existing_repo = Repo('testrepo') existing_repo['proxy_username'] = "******" incoming_repo = {'proxy_username': '******'} update_action = RepoUpdateActionCommand() update_action.override_supported = True self.assertRaises(UnsupportedOperationException, update_action.update_repo, existing_repo, incoming_repo)
def test_update_when_registered_and_existing_repo(self, mock_file): mock_file = mock_file.return_value mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')]) def stub_content(): return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])] update_action = RepoUpdateActionCommand() update_action.get_unique_content = stub_content update_action.override_supported = True update_report = update_action.perform() written_repo = mock_file.update.call_args[0][0] self.assertEquals('new', written_repo['gpgcheck']) self.assertEquals('new_key', written_repo['gpgkey']) self.assertEquals(1, update_report.updates())