Example #1
0
    def test_sends_commit_request(self) -> None:
        with engine_responding_to_streaming_query() as engine, client().open(
        ) as tx:
            tx.execute(query)
            tx.commit()

        expected = TxRequest(commit=Commit())
        engine.verify(expected)
Example #2
0
    def test_sends_execute_query_request_with_parameters(self) -> None:
        with engine_responding_to_streaming_query() as engine, client().open(
        ) as tx:
            tx.execute(query)

        expected = TxRequest(
            execQuery=ExecQuery(query=Query(value=query), infer=None))
        engine.verify(expected)
Example #3
0
 def test_completes_request(self) -> None:
     with engine_responding_to_streaming_query(), client().open() as tx:
         tx.execute(query)
         tx.commit()
Example #4
0
 def test_completes_request(self) -> None:
     with engine_responding_to_streaming_query():
         client().execute(query)
Example #5
0
 def test_specifies_inference_off_when_requested(self) -> None:
     with engine_responding_to_streaming_query() as engine:
         client().execute(query, infer=False)
         engine.verify(lambda req: not req.execQuery.infer.value)
Example #6
0
 def test_sends_open_request_with_keyspace(self) -> None:
     with engine_responding_to_streaming_query() as engine:
         client().execute(query)
         expected_request = TxRequest(
             open=Open(keyspace=Keyspace(value=keyspace), txType=Write))
         engine.verify(expected_request)
Example #7
0
 def test_valid_query_returns_expected_response(self) -> None:
     with engine_responding_to_streaming_query():
         self.assertEqual(client().execute(query), expected_response)
Example #8
0
    def test_specifies_inference_on_when_requested(self) -> None:
        with engine_responding_to_streaming_query() as engine, client().open(
        ) as tx:
            tx.execute(query, infer=True)

        engine.verify(lambda req: req.execQuery.infer.value)