Here are the examples of the python api mock.sentinel.dt taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Source : test_model.py
with Apache License 2.0
from googleapis
with Apache License 2.0
from googleapis
def test__prepare_for_put_auto_now():
prop = model.DateTimeProperty(name="dt_val", auto_now=True)
values1 = {}
values2 = {prop._name: mock.sentinel.dt}
for values in (values1, values2):
entity = mock.Mock(_values=values, spec=("_values",))
with mock.patch.object(prop, "_now") as _now:
prop._prepare_for_put(entity)
assert entity._values == {prop._name: _now.return_value}
_now.assert_called_once_with()
@staticmethod
3
Source : test_model.py
with Apache License 2.0
from googleapis
with Apache License 2.0
from googleapis
def test__prepare_for_put_auto_now_add():
prop = model.DateTimeProperty(name="dt_val", auto_now_add=True)
values1 = {}
values2 = {prop._name: mock.sentinel.dt}
for values in (values1, values2):
entity = mock.Mock(_values=values.copy(), spec=("_values",))
with mock.patch.object(prop, "_now") as _now:
prop._prepare_for_put(entity)
if values:
assert entity._values == values
_now.assert_not_called()
else:
assert entity._values != values
assert entity._values == {prop._name: _now.return_value}
_now.assert_called_once_with()
@staticmethod