OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from google.appengine.api import datastore_errors | 5 from google.appengine.api import datastore_errors |
6 from google.appengine.ext import ndb | 6 from google.appengine.ext import ndb |
7 | 7 |
8 from testing_utils import testing | 8 from testing_utils import testing |
9 | 9 |
10 from model.versioned_model import VersionedModel | 10 from gae_libs.model.versioned_model import VersionedModel |
11 | 11 |
12 | 12 |
13 class _Entity(VersionedModel): | 13 class _Entity(VersionedModel): |
14 value = ndb.IntegerProperty(indexed=False) | 14 value = ndb.IntegerProperty(indexed=False) |
15 | 15 |
16 | 16 |
17 class VersionedModelTest(testing.AppengineTestCase): | 17 class VersionedModelTest(testing.AppengineTestCase): |
18 | 18 |
19 def testGetRootModel(self): | 19 def testGetRootModel(self): |
20 root_model_class = _Entity._GetRootModel() | 20 root_model_class = _Entity._GetRootModel() |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 raise datastore_errors.BadRequestError() | 191 raise datastore_errors.BadRequestError() |
192 return original_ndb_transaction(func, **options) | 192 return original_ndb_transaction(func, **options) |
193 self.mock(ndb, 'transaction', MockNdbTransaction) | 193 self.mock(ndb, 'transaction', MockNdbTransaction) |
194 | 194 |
195 entity = _Entity.Create() | 195 entity = _Entity.Create() |
196 key, saved = entity.Save() | 196 key, saved = entity.Save() |
197 expected_key = ndb.Key('_EntityRoot', 1, '_Entity', 1) | 197 expected_key = ndb.Key('_EntityRoot', 1, '_Entity', 1) |
198 self.assertEqual(expected_key, key) | 198 self.assertEqual(expected_key, key) |
199 self.assertEqual([1], calls) | 199 self.assertEqual([1], calls) |
200 self.assertTrue(saved) | 200 self.assertTrue(saved) |
OLD | NEW |