def test_not_found_backend(self): """Check if it fails when a backend is not found""" with self.assertRaises(NotFoundError): _ = [ item for item in execute_perceval_backend( 'test', 'mock_backend', {}) ] self.assertEqual(e.exception.element, 'mock_backend')
def test_backend(self): """Execute Git backend""" args = {'uri' : 'http://example.com/', 'gitpath' : 'data/git_log.txt'} commits = execute_perceval_backend('test', 'git', args) commits = [commit['data']['commit'] for commit in commits] expected = ['456a68ee1407a77f3e804a30dff245bb6c6b872f', '51a3b654f252210572297f47597b31527c475fb8', 'ce8e0b86a1e9877f42fe9453ede418519115f367', '589bb080f059834829a2a5955bebfd7c2baa110a', 'c6ba8f7a1058db3e6b4bc6f1090e932b107605fb', 'c0d66f92a95e31c77be08dc9d0f11a16715d1885', '7debcf8a2f57f86663809c58b5c07a398be7674c', '87783129c3f00d2c81a3a8e585eb86a47e39891a', 'bc57a9209f096a130dcc5ba7089a8663f758a703'] self.assertListEqual(commits, expected)
def test_backend(self): """Execute Git backend""" args = {'uri': 'http://example.com/', 'gitpath': 'data/git_log.txt'} commits = execute_perceval_backend('test', 'git', args) commits = [commit['data']['commit'] for commit in commits] expected = [ '456a68ee1407a77f3e804a30dff245bb6c6b872f', '51a3b654f252210572297f47597b31527c475fb8', 'ce8e0b86a1e9877f42fe9453ede418519115f367', '589bb080f059834829a2a5955bebfd7c2baa110a', 'c6ba8f7a1058db3e6b4bc6f1090e932b107605fb', 'c0d66f92a95e31c77be08dc9d0f11a16715d1885', '7debcf8a2f57f86663809c58b5c07a398be7674c', '87783129c3f00d2c81a3a8e585eb86a47e39891a', 'bc57a9209f096a130dcc5ba7089a8663f758a703' ] self.assertListEqual(commits, expected)
def test_not_found_parameters(self): """Check if it fails when a required backend parameter is not found""" with self.assertRaises(NotFoundError): _ = [item for item in execute_perceval_backend('test', 'git', {})] self.assertEqual(e.exception.element, 'gitlog')
def test_not_found_backend(self): """Check if it fails when a backend is not found""" with self.assertRaises(NotFoundError): _ = [item for item in execute_perceval_backend('test', 'mock_backend', {})] self.assertEqual(e.exception.element, 'mock_backend')