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

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

Issue 14218004: Devserver: only populate data during cron jobs, meaning all data from instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integration test Created 7 years, 8 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/persistent_object_store_test.py
diff --git a/chrome/common/extensions/docs/server2/persistent_object_store_test.py b/chrome/common/extensions/docs/server2/persistent_object_store_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..0b83aba135d891a04731ee6f882da4523db29a58
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/persistent_object_store_test.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from persistent_object_store import PersistentObjectStore
+import unittest
+
+class PersistentObjectStoreTest(unittest.TestCase):
+ '''Tests for PersistentObjectStore. These are all a bit contrived because
+ ultimately it comes down to our use of the appengine datastore API, and we
+ mock it out for tests anyway. Who knows whether it's correct.
+ '''
+ def testPersistence(self):
+ # First object store.
+ object_store = PersistentObjectStore('test')
+ object_store.Set('key', 'value')
+ self.assertEqual('value', object_store.Get('key').Get())
+ # Other object store should have it too.
+ another_object_store = PersistentObjectStore('test')
+ self.assertEqual('value', another_object_store.Get('key').Get())
+ # Setting in the other store should set in both.
+ mapping = {'key2': 'value2', 'key3': 'value3'}
+ another_object_store.SetMulti(mapping)
+ self.assertEqual(mapping, object_store.GetMulti(mapping.keys()).Get())
+ self.assertEqual(mapping,
+ another_object_store.GetMulti(mapping.keys()).Get())
+ # And delete.
+ object_store.DelMulti(mapping.keys())
+ self.assertEqual({}, object_store.GetMulti(mapping.keys()).Get())
+ self.assertEqual({}, another_object_store.GetMulti(mapping.keys()).Get())
+
+ def testNamespaceIsolation(self):
+ object_store = PersistentObjectStore('test')
+ another_object_store = PersistentObjectStore('another')
+ object_store.Set('key', 'value')
+ self.assertEqual(None, another_object_store.Get('key').Get())
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « chrome/common/extensions/docs/server2/persistent_object_store.py ('k') | chrome/common/extensions/docs/server2/preview.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698