def test_get_tree(self): req_path = 'project/+/deadbeef/dir' gerrit.fetch_json.return_value = { 'id': 'c244aa92a18cd719c55205f99e04333840330012', 'entries': [ { 'id': '0244aa92a18cd719c55205f99e04333840330012', 'name': 'a', 'type': 'blob', 'mode': 33188, }, { 'id': '9c247a8aa968a3e2641addf1f4bd4acfc24e7915', 'name': 'b', 'type': 'blob', 'mode': 33188, }, ], } tree = gitiles.get_tree(HOSTNAME, 'project', 'deadbeef', '/dir') gerrit.fetch_json.assert_called_once_with(HOSTNAME, req_path) self.assertIsNotNone(tree) self.assertEqual(tree.id, 'c244aa92a18cd719c55205f99e04333840330012') self.assertEqual(tree.entries[0].id, '0244aa92a18cd719c55205f99e04333840330012') self.assertEqual(tree.entries[0].name, 'a')
def test_get_tree(self): req_path = 'project/+/deadbeef/dir' self.mock_fetch_json({ 'id': 'c244aa92a18cd719c55205f99e04333840330012', 'entries': [ { 'id': '0244aa92a18cd719c55205f99e04333840330012', 'name': 'a', 'type': 'blob', 'mode': 33188, }, { 'id': '9c247a8aa968a3e2641addf1f4bd4acfc24e7915', 'name': 'b', 'type': 'blob', 'mode': 33188, }, ], }) tree = gitiles.get_tree(HOSTNAME, 'project', 'deadbeef', '/dir') gerrit.fetch_json_async.assert_called_once_with(HOSTNAME, req_path) self.assertIsNotNone(tree) self.assertEqual(tree.id, 'c244aa92a18cd719c55205f99e04333840330012') self.assertEqual( tree.entries[0].id, '0244aa92a18cd719c55205f99e04333840330012') self.assertEqual(tree.entries[0].name, 'a')
def test_get_tree(self): req_path = "project/+/deadbeef/dir" self.mock_fetch_json( { "id": "c244aa92a18cd719c55205f99e04333840330012", "entries": [ {"id": "0244aa92a18cd719c55205f99e04333840330012", "name": "a", "type": "blob", "mode": 33188}, {"id": "9c247a8aa968a3e2641addf1f4bd4acfc24e7915", "name": "b", "type": "blob", "mode": 33188}, ], } ) tree = gitiles.get_tree(HOSTNAME, "project", "deadbeef", "/dir") gerrit.fetch_json_async.assert_called_once_with(HOSTNAME, req_path) self.assertIsNotNone(tree) self.assertEqual(tree.id, "c244aa92a18cd719c55205f99e04333840330012") self.assertEqual(tree.entries[0].id, "0244aa92a18cd719c55205f99e04333840330012") self.assertEqual(tree.entries[0].name, "a")