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

Side by Side Diff: chrome/common/extensions/docs/server2/gitiles_file_system_test.py

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import base64 6 import base64
7 import json 7 import json
8 import unittest 8 import unittest
9 9
10 from extensions_paths import SERVER2 10 from extensions_paths import SERVER2
(...skipping 29 matching lines...) Expand all
40 40
41 41
42 class DownloadError(Exception): 42 class DownloadError(Exception):
43 pass 43 pass
44 44
45 45
46 class _FakeGitilesFetcher(object): 46 class _FakeGitilesFetcher(object):
47 def __init__(self, fs): 47 def __init__(self, fs):
48 self._fs = fs 48 self._fs = fs
49 49
50 def FetchAsync(self, url): 50 def FetchAsync(self, url, access_token=None):
51 def resolve(): 51 def resolve():
52 assert '?' in url 52 assert '?' in url
53 if url == _BASE_URL + '?format=JSON': 53 if url == _BASE_URL + '?format=JSON':
54 return _Response(json.dumps({'commit': 'a_commit'})) 54 return _Response(json.dumps({'commit': 'a_commit'}))
55 path, fmt = url.split('?') 55 path, fmt = url.split('?')
56 # Fetch urls are of the form <base_url>/<path>. We only want <path>. 56 # Fetch urls are of the form <base_url>/<path>. We only want <path>.
57 path = path.split('/', 1)[1] 57 path = path.split('/', 1)[1]
58 if path == _REAL_DATA_DIR: 58 if path == _REAL_DATA_DIR:
59 return _Response(ReadFile(*_TEST_DATA)) 59 return _Response(ReadFile(*_TEST_DATA))
60 # ALWAYS skip not found here. 60 # ALWAYS skip not found here.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 other_gitiles_fs = GitilesFileSystem.Create(commit='abcdefghijklmnop') 154 other_gitiles_fs = GitilesFileSystem.Create(commit='abcdefghijklmnop')
155 self.assertEqual(self._gitiles_fs.GetIdentity(), 155 self.assertEqual(self._gitiles_fs.GetIdentity(),
156 other_gitiles_fs.GetIdentity()) 156 other_gitiles_fs.GetIdentity())
157 157
158 yet_another_gitiles_fs = GitilesFileSystem.Create(branch='different') 158 yet_another_gitiles_fs = GitilesFileSystem.Create(branch='different')
159 self.assertNotEqual(self._gitiles_fs.GetIdentity(), 159 self.assertNotEqual(self._gitiles_fs.GetIdentity(),
160 yet_another_gitiles_fs.GetIdentity()) 160 yet_another_gitiles_fs.GetIdentity())
161 161
162 if __name__ == '__main__': 162 if __name__ == '__main__':
163 unittest.main() 163 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698