def test_remove_repository(self): """Remove a repository""" args = {'from_date': '1970-01-01', 'component': 'test'} manager = RepositoryManager() manager.add( 'http://example.com/', 'mock_backend', args, '/tmp/example.com', ) manager.add('http://example.org/', 'to_remove', None, '/tmp/example.org') manager.add('http://example.net/', 'test_backend', None, '/tmp/example.net') repos = manager.repositories self.assertEqual(len(repos), 3) manager.remove('http://example.org/') repos = manager.repositories self.assertEqual(len(repos), 2) self.assertEqual(repos[0].origin, 'http://example.com/') self.assertEqual(repos[1].origin, 'http://example.net/')
def test_remove_not_found(self): """Check whether it raises an exception when a repo is not found""" manager = RepositoryManager() with self.assertRaises(NotFoundError): manager.remove('http://example.com/') manager.add('http://example.org/', 'mock_backend', None, '/tmp/example') with self.assertRaises(NotFoundError): manager.remove('http://example.com/')
def test_remove_not_found(self): """Check whether it raises an exception when a repo is not found""" manager = RepositoryManager() with self.assertRaises(NotFoundError): manager.remove('http://example.com/') manager.add('http://example.org/', 'mock_backend', None, '/tmp/example') with self.assertRaises(NotFoundError): manager.remove('http://example.com/')
def test_remove_repository(self): """Remove a repository""" args = {'from_date' : '1970-01-01', 'component' : 'test'} manager = RepositoryManager() manager.add('http://example.com/', 'mock_backend', args, '/tmp/example.com',) manager.add('http://example.org/', 'to_remove', None, '/tmp/example.org') manager.add('http://example.net/', 'test_backend', None, '/tmp/example.net') repos = manager.repositories self.assertEqual(len(repos), 3) manager.remove('http://example.org/') repos = manager.repositories self.assertEqual(len(repos), 2) self.assertEqual(repos[0].origin, 'http://example.com/') self.assertEqual(repos[1].origin, 'http://example.net/')