예제 #1
0
    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())
예제 #2
0
 def test_validate(self):
     appengine.CredentialsProperty().validate(self.credentials)
     appengine.CredentialsProperty().validate(None)
     with self.assertRaises(db.BadValueError):
         appengine.CredentialsProperty().validate(42)
예제 #3
0
class TestCredentialsModel(db.Model):
    credentials = appengine.CredentialsProperty()