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

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

Issue 14247024: Devserver: allow SubversionFileSystem to be pinned to a specific rev on construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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/subversion_file_system_test.py
diff --git a/chrome/common/extensions/docs/server2/subversion_file_system_test.py b/chrome/common/extensions/docs/server2/subversion_file_system_test.py
index 8fd702fdd32ee7d36902a1cc958d05a64e720d2f..72819082316a47cf7d9a599a568587f5aae61fd9 100755
--- a/chrome/common/extensions/docs/server2/subversion_file_system_test.py
+++ b/chrome/common/extensions/docs/server2/subversion_file_system_test.py
@@ -10,6 +10,7 @@ import unittest
from fake_url_fetcher import FakeUrlFetcher
from file_system import StatInfo
+from future import Future
from subversion_file_system import SubversionFileSystem
class SubversionFileSystemTest(unittest.TestCase):
@@ -56,5 +57,40 @@ class SubversionFileSystemTest(unittest.TestCase):
stat_info = file_system.Stat('stat/extension_api.h')
self.assertEquals(StatInfo('146163'), stat_info)
+ def testRevisions(self):
+ # This is a super hacky test. Record the path that was fetched then exit the
+ # test. Compare.
+ class ValueErrorFetcher(object):
+ def __init__(self):
+ self.last_fetched = None
+
+ def FetchAsync(self, path):
+ self.last_fetched = path
+ raise ValueError()
+
+ def Fetch(self, path):
+ self.last_fetched = path
+ raise ValueError()
+
+ file_fetcher = ValueErrorFetcher()
+ stat_fetcher = ValueErrorFetcher()
+ svn_path = 'svn:'
+
+ svn_file_system = SubversionFileSystem(file_fetcher,
+ stat_fetcher,
+ svn_path,
+ revision=42)
+
+ self.assertRaises(ValueError, svn_file_system.ReadSingle, 'dir/file')
+ self.assertEqual('dir/file?p=42', file_fetcher.last_fetched)
+ # Stat() will always stat directories.
+ self.assertRaises(ValueError, svn_file_system.Stat, 'dir/file')
+ self.assertEqual('dir/?pathrev=42', stat_fetcher.last_fetched)
+
+ self.assertRaises(ValueError, svn_file_system.ReadSingle, 'dir/')
+ self.assertEqual('dir/?p=42', file_fetcher.last_fetched)
+ self.assertRaises(ValueError, svn_file_system.Stat, 'dir/')
+ self.assertEqual('dir/?pathrev=42', stat_fetcher.last_fetched)
+
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698