Created
December 23, 2011 01:29
-
-
Save mentat/1512674 to your computer and use it in GitHub Desktop.
Failing polymodel test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ndb.old/polymodel_test.py 2011-12-20 10:27:11.000000000 -0600 | |
+++ ndb/polymodel_test.py 2011-12-22 19:26:29.000000000 -0600 | |
@@ -7,6 +7,7 @@ | |
import unittest | |
from google.appengine.api import namespace_manager | |
+from google.appengine.api import datastore_types | |
from . import polymodel | |
from . import model | |
@@ -62,6 +63,25 @@ | |
self.assertEqual(Moccasin.query().fetch(), [m]) | |
self.assertEqual(Sneaker.query().fetch(), [snkr]) | |
+ | |
+ def testBlobKeyProperty(self): | |
+ class MyModel(PolyModel): | |
+ pass | |
+ class MyDerivedModel(MyModel): | |
+ image = model.BlobKeyProperty() | |
+ | |
+ test_blobkey = datastore_types.BlobKey('testkey123') | |
+ m = MyDerivedModel() | |
+ m.image = test_blobkey | |
+ m.put() | |
+ | |
+ m = m.key.get() | |
+ m.image = test_blobkey | |
+ m.put() | |
+ | |
+ self.assertTrue(isinstance(m.image, datastore_types.BlobKey)) | |
+ self.assertEqual(str(m.image), str(test_blobkey)) | |
+ | |
def testClassKeyProperty(self): | |
# Tests for the class_ property. | |
class Animal(PolyModel): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment