def test_make_value_from_datastore(self): self.assertIsNone( appengine.CredentialsProperty().make_value_from_datastore(None)) self.assertIsNone( appengine.CredentialsProperty().make_value_from_datastore('')) self.assertIsNone( appengine.CredentialsProperty().make_value_from_datastore('{')) decoded = appengine.CredentialsProperty().make_value_from_datastore( self.credentials.to_json()) self.assertEqual(self.credentials.to_json(), decoded.to_json())
def test_validate(self): appengine.CredentialsProperty().validate(self.credentials) appengine.CredentialsProperty().validate(None) with self.assertRaises(db.BadValueError): appengine.CredentialsProperty().validate(42)
class TestCredentialsModel(db.Model): credentials = appengine.CredentialsProperty()