Beispiel #1
0
    def test_prepare_for_execute_merges_queries(self, upsert_command):
        query = deepcopy(upsert_command.body.meta["query"])
        assert query

        for key in query.keys():
            assert key not in upsert_command.body.attributes

        UpsertCommand.prepare_for_execute([upsert_command], {"merge_query": True})

        for key in query.keys():
            assert key in upsert_command.body.meta["query"]
            assert key in upsert_command.body.attributes
Beispiel #2
0
    def test_prepare_for_execute_merges_queries(self, user_command, group_command):
        # You don't get mixed command types, but it's helpful here as one has
        # a query and the other doesn't

        assert "groupid" in group_command.body.meta["query"]
        assert "groupid" not in group_command.body.attributes

        UpsertCommand.prepare_for_execute(
            [user_command, group_command], {"merge_query": True}
        )

        assert "groupid" in group_command.body.meta["query"]
        assert "groupid" in group_command.body.attributes
Beispiel #3
0
    def test_prepare_for_execute_pops_merge_query_from_config(self, user_command):
        config = {"merge_query": True, "another": True}

        UpsertCommand.prepare_for_execute([user_command], config)

        assert config == {"another": True}