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

Side by Side Diff: chrome/common/extensions/docs/server2/test_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
« no previous file with comments | « chrome/common/extensions/docs/server2/test_object_store.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 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 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 from test_object_store import TestObjectStore 6 from test_object_store import TestObjectStore
7 import unittest 7 import unittest
8 8
9 class TestObjectStoreTest(unittest.TestCase): 9 class TestObjectStoreTest(unittest.TestCase):
10 def testEmpty(self): 10 def testEmpty(self):
11 store = TestObjectStore('namespace') 11 store = TestObjectStore('namespace')
12 self.assertEqual(None, store.Get('hi').Get()) 12 self.assertEqual(None, store.Get('hi').Get())
13 self.assertEqual({}, store.GetMulti(['hi', 'lo']).Get()) 13 self.assertEqual({}, store.GetMulti(['hi', 'lo']).Get())
14 14
15 def testNonEmpty(self): 15 def testNonEmpty(self):
16 store = TestObjectStore('namespace') 16 store = TestObjectStore('namespace')
17 store.Set('hi', 'bye') 17 store.Set('hi', 'bye')
18 self.assertEqual('bye', store.Get('hi').Get()) 18 self.assertEqual('bye', store.Get('hi').Get())
19 self.assertEqual({'hi': 'bye'}, store.GetMulti(['hi', 'lo']).Get()) 19 self.assertEqual({'hi': 'bye'}, store.GetMulti(['hi', 'lo']).Get())
20 store.Set('hi', 'blah') 20 store.Set('hi', 'blah')
21 self.assertEqual('blah', store.Get('hi').Get()) 21 self.assertEqual('blah', store.Get('hi').Get())
22 self.assertEqual({'hi': 'blah'}, store.GetMulti(['hi', 'lo']).Get()) 22 self.assertEqual({'hi': 'blah'}, store.GetMulti(['hi', 'lo']).Get())
23 store.Delete('hi') 23 store.Del('hi')
24 self.assertEqual(None, store.Get('hi').Get()) 24 self.assertEqual(None, store.Get('hi').Get())
25 self.assertEqual({}, store.GetMulti(['hi', 'lo']).Get()) 25 self.assertEqual({}, store.GetMulti(['hi', 'lo']).Get())
26 26
27 def testCheckAndReset(self):
28 store = TestObjectStore('namespace')
29 store.Set('x', 'y')
30 self.assertTrue(store.CheckAndReset(set_count=1))
31 store.Set('x', 'y')
32 store.Set('x', 'y')
33 self.assertTrue(store.CheckAndReset(set_count=2))
34 store.Set('x', 'y')
35 store.Set('x', 'y')
36 store.Get('x')
37 store.Get('x')
38 store.Get('x')
39 store.Del('x')
40 self.assertTrue(store.CheckAndReset(get_count=3, set_count=2, del_count=1))
41
27 if __name__ == '__main__': 42 if __name__ == '__main__':
28 unittest.main() 43 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/test_object_store.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698