def test_save_empty_last_sync(config_dir, mock, json_mock): watson = Watson(last_sync=arrow.now(), config_dir=config_dir) watson.last_sync = None mock.patch('%s.open' % builtins, mock.mock_open()) watson.save() assert json_mock.call_count == 1 assert json_mock.call_args[0][0] == 0
def test_save_empty_last_sync(config_dir): watson = Watson(last_sync=arrow.now(), config_dir=config_dir) watson.last_sync = None with mock.patch('%s.open' % builtins, mock.mock_open()): with mock.patch('json.dump') as json_mock: watson.save() assert json_mock.call_count == 1 assert json_mock.call_args[0][0] == 0