def watson(config_dir): return Watson(config_dir=config_dir)
def test_current_with_empty_given_state(config_dir, mock): content = json.dumps({'project': 'foo', 'start': 4000}) watson = Watson(current=[], config_dir=config_dir) mock.patch('%s.open' % builtins, mock.mock_open(read_data=content)) assert watson.current == {}
def test_frames_with_empty_given_state(config_dir, mock): content = json.dumps([[0, 10, 'foo', None, ['A']]]) watson = Watson(frames=[], config_dir=config_dir) mock.patch('%s.open' % builtins, mock.mock_open(read_data=content)) assert len(watson.frames) == 0
def test_empty_config_dir(): watson = Watson() assert watson._dir == get_app_dir('watson')
def test_last_sync_with_empty_given_state(config_dir, mock): content = json.dumps(123) watson = Watson(last_sync=None, config_dir=config_dir) mock.patch('%s.open' % builtins, mock.mock_open(read_data=content)) assert watson.last_sync == arrow.get(0)