Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/gitiles_file_system_test.py |
| diff --git a/chrome/common/extensions/docs/server2/gitiles_file_system_test.py b/chrome/common/extensions/docs/server2/gitiles_file_system_test.py |
| index 438a6595388b0dd062d2c259606eeb1c8675706f..7986bddfdc57bd43fb85a4c918b26a9a8d4592bf 100755 |
| --- a/chrome/common/extensions/docs/server2/gitiles_file_system_test.py |
| +++ b/chrome/common/extensions/docs/server2/gitiles_file_system_test.py |
| @@ -19,6 +19,7 @@ from test_util import ReadFile |
| _BASE_URL = '' |
| _REAL_DATA_DIR = 'chrome/common/extensions/docs/templates/public/extensions/' |
| +_TEST_DATA = (SERVER2, 'test_data', 'gitiles_file_system', 'public_extensions') |
| # GitilesFileSystem expects file content to be encoded in base64. |
| _TEST_FS = { |
| 'test1.txt': base64.b64encode('test1'), |
| @@ -54,8 +55,7 @@ class _FakeGitilesFetcher(object): |
| # Fetch urls are of the form <base_url>/<path>. We only want <path>. |
| path = path.split('/', 1)[1] |
| if path == _REAL_DATA_DIR: |
| - return _Response(ReadFile(SERVER2, 'test_data', 'gitiles_file_system', |
| - 'public_extensions')) |
| + return _Response(ReadFile(*_TEST_DATA)) |
| # ALWAYS skip not found here. |
| content = self._fs.Read((path,), |
| skip_not_found=True).Get().get(path, None) |
| @@ -65,7 +65,11 @@ class _FakeGitilesFetcher(object): |
| # GitilesFS expects directory content as a JSON string. |
| if 'JSON' in fmt: |
| content = json.dumps({ |
| - 'entries': [{'name': name} for name in content] |
| + 'entries': [{ |
| + # GitilesFS expects directory names to not have a trailing '/'. |
| + 'name': name.rstrip('/'), |
| + 'type': 'tree' if name.endswith('/') else 'blob' |
|
not at google - send to devlin
2014/08/21 20:58:29
You can use IsDirectory in path_util.py.
|
| + } for name in content] |
| }) |
| return _Response(content) |
| return Future(callback=resolve) |