Ejemplo n.º 1
0
 def test_eventually_consistent_legacy(runstate):
     options = _api._get_read_options(
         {"read_policy": _api.EVENTUAL_CONSISTENCY}
     )
     assert options == datastore_pb2.ReadOptions(
         read_consistency=datastore_pb2.ReadOptions.EVENTUAL
     )
Ejemplo n.º 2
0
 def test_eventually_consistent_with_transaction(runstate):
     with pytest.raises(ValueError):
         _api._get_read_options(
             {"read_consistency": _api.EVENTUAL, "transaction": b"txfoo"}
         )
Ejemplo n.º 3
0
 def test_eventually_consistent(runstate):
     options = _api._get_read_options({"read_consistency": _api.EVENTUAL})
     assert options == datastore_pb2.ReadOptions(
         read_consistency=datastore_pb2.ReadOptions.EVENTUAL
     )
Ejemplo n.º 4
0
 def test_args_override_transaction(runstate):
     runstate.transaction = b"txfoo"
     options = _api._get_read_options({"transaction": b"txbar"})
     assert options == datastore_pb2.ReadOptions(transaction=b"txbar")
Ejemplo n.º 5
0
 def test_no_args_transaction(runstate):
     runstate.transaction = b"txfoo"
     options = _api._get_read_options({})
     assert options == datastore_pb2.ReadOptions(transaction=b"txfoo")
Ejemplo n.º 6
0
 def test_no_args_no_transaction(runstate):
     assert _api._get_read_options({}) == datastore_pb2.ReadOptions()
Ejemplo n.º 7
0
 def test_args_override_transaction(context):
     with context.new(transaction=b"txfoo"):
         options = _api._get_read_options({"transaction": b"txbar"})
         assert options == datastore_pb2.ReadOptions(transaction=b"txbar")
Ejemplo n.º 8
0
 def test_no_args_transaction(context):
     with context.new(transaction=b"txfoo"):
         options = _api._get_read_options({})
         assert options == datastore_pb2.ReadOptions(transaction=b"txfoo")