def test_get_file_content(self): req_path = "project/+/master/a.txt" self.mock_fetch(base64.b64encode("content")) content = gitiles.get_file_content(HOSTNAME, "project", "master", "/a.txt") gerrit.fetch_async.assert_called_once_with(HOSTNAME, req_path, headers={"Accept": "text/plain"}) self.assertEqual(content, "content")
def test_get_file_content(self): req_path = 'project/+/master/a.txt' self.mock_fetch(base64.b64encode('content')) content = gitiles.get_file_content(HOSTNAME, 'project', 'master', '/a.txt') gerrit.fetch_async.assert_called_once_with( HOSTNAME, req_path, headers={'Accept': 'text/plain'}) self.assertEqual(content, 'content')
def test_get_file_content(self): req_path = 'project/+/master/./a.txt' gerrit.fetch.return_value.content = base64.b64encode('content') content = gitiles.get_file_content(HOSTNAME, 'project', 'master', '/a.txt') gerrit.fetch.assert_called_once_with( HOSTNAME, req_path, accept_header='text/plain') self.assertEqual(content, 'content')