Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8103)

Unified Diff: chrome/common/extensions/docs/server2/gitiles_file_system_test.py

Issue 498503002: Docserver: Fixes for GitilesFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698