示例#1
0
def watson(config_dir):
    return Watson(config_dir=config_dir)
示例#2
0
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 == {}
示例#3
0
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
示例#4
0
def test_empty_config_dir():
    watson = Watson()
    assert watson._dir == get_app_dir('watson')
示例#5
0
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)