lundi 2 février 2015

GAE test to verify that ndb entity was **not** put in the datastore

Very simply, I want to run some code and verify that no entities of kind MyEntity(ndb.Model) were put the datastore.


I've tried doing MyEntity.query().fetch(keys_only=True), but that doesn't seem to be strongly-consistent (i.e. it doesn't show the one entity I just added), so returning an empty list is not true confirmation. (I should add that I'm using the testbed.init_datastore_v3_stub and I've tried datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1) and MasterSlaveConsistencyPolicy() with no success.)


I thought there was a way to do a strongly-consistent 'get' for all keys of a kind, but now I can't find any documentation to support that.


I know that I can do a strongly-consistent get if I have a Key, but how would that translate to verification that an entity was not added, so there is no key to get?


Aucun commentaire:

Enregistrer un commentaire