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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 from persistent_object_store import PersistentObjectStore
7 import unittest
8
9 class PersistentObjectStoreTest(unittest.TestCase):
10 '''Tests for PersistentObjectStore. These are all a bit contrived because
11 ultimately it comes down to our use of the appengine datastore API, and we
12 mock it out for tests anyway. Who knows whether it's correct.
13 '''
14 def testPersistence(self):
15 # First object store.
16 object_store = PersistentObjectStore('test')
17 object_store.Set('key', 'value')
18 self.assertEqual('value', object_store.Get('key').Get())
19 # Other object store should have it too.
20 another_object_store = PersistentObjectStore('test')
21 self.assertEqual('value', another_object_store.Get('key').Get())
22 # Setting in the other store should set in both.
23 mapping = {'key2': 'value2', 'key3': 'value3'}
24 another_object_store.SetMulti(mapping)
25 self.assertEqual(mapping, object_store.GetMulti(mapping.keys()).Get())
26 self.assertEqual(mapping,
27 another_object_store.GetMulti(mapping.keys()).Get())
28 # And delete.
29 object_store.DelMulti(mapping.keys())
30 self.assertEqual({}, object_store.GetMulti(mapping.keys()).Get())
31 self.assertEqual({}, another_object_store.GetMulti(mapping.keys()).Get())
32
33 def testNamespaceIsolation(self):
34 object_store = PersistentObjectStore('test')
35 another_object_store = PersistentObjectStore('another')
36 object_store.Set('key', 'value')
37 self.assertEqual(None, another_object_store.Get('key').Get())
38
39 if __name__ == '__main__':
40 unittest.main()
OLDNEW
« 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