def test_delete_composite_indexes(self):
        db_batch = flexmock()
        db_batch.should_receive("batch_delete").and_return(None)
        dd = DatastoreDistributed(db_batch, self.get_zookeeper())
        dd = flexmock(dd)
        dd.should_receive("get_composite_index_key").and_return("somekey")
        dd.should_receive("get_entity_kind").and_return("kind")
        item1 = self.get_new_entity_proto("appid",
                                          "kind",
                                          "ent_name",
                                          "prop1",
                                          "propvalue",
                                          ns="")
        item2 = self.get_new_entity_proto("appid",
                                          "kind",
                                          "ent_name1",
                                          "prop1",
                                          "propvalue",
                                          ns="")
        composite_index = entity_pb.CompositeIndex()
        composite_index.set_id(123)
        composite_index.set_app_id("appid")

        definition = composite_index.mutable_definition()
        definition.set_entity_type("kind")
        dd.delete_composite_indexes([item1, item2], [composite_index])
Ejemplo n.º 2
0
  def test_delete_composite_indexes(self):
    db_batch = flexmock()
    db_batch.should_receive("batch_delete").and_return(None)
    dd = DatastoreDistributed(db_batch, self.get_zookeeper())
    dd = flexmock(dd)
    dd.should_receive("get_composite_index_key").and_return("somekey")
    dd.should_receive("get_entity_kind").and_return("kind")
    item1 = self.get_new_entity_proto("appid" , "kind", "ent_name", "prop1", "propvalue", ns="")
    item2= self.get_new_entity_proto("appid" , "kind", "ent_name1", "prop1", "propvalue", ns="")
    composite_index = entity_pb.CompositeIndex()
    composite_index.set_id(123)
    composite_index.set_app_id("appid")

    definition = composite_index.mutable_definition()
    definition.set_entity_type("kind")
    dd.delete_composite_indexes([item1, item2], [composite_index])
  def test_delete_composite_indexes(self):
    db_batch = flexmock()
    db_batch.should_receive("batch_delete").and_return(None)
    dd = DatastoreDistributed(db_batch, self.get_zookeeper())
    dd = flexmock(dd)
    dd.should_receive("get_composite_index_key").and_return("somekey")
    dd.should_receive("get_entity_kind").and_return("kind")
    item1 = Item(key_name="Bob", name="Bob", _app="hello")
    item2 = Item(key_name="Sally", name="Sally", _app="hello")
    composite_index = entity_pb.CompositeIndex()
    composite_index.set_id(123)
    composite_index.set_app_id("appid")

    definition = composite_index.mutable_definition()
    definition.set_entity_type("kind")

    dd.delete_composite_indexes([item1, item2], [composite_index])
Ejemplo n.º 4
0
    def test_delete_composite_indexes(self):
        db_batch = flexmock()
        db_batch.should_receive("batch_delete").and_return(None)
        dd = DatastoreDistributed(db_batch, self.get_zookeeper())
        dd = flexmock(dd)
        dd.should_receive("get_composite_index_key").and_return("somekey")
        dd.should_receive("get_entity_kind").and_return("kind")
        item1 = Item(key_name="Bob", name="Bob", _app="hello")
        item2 = Item(key_name="Sally", name="Sally", _app="hello")
        composite_index = entity_pb.CompositeIndex()
        composite_index.set_id(123)
        composite_index.set_app_id("appid")

        definition = composite_index.mutable_definition()
        definition.set_entity_type("kind")

        dd.delete_composite_indexes([item1, item2], [composite_index])