Esempio n. 1
0
def test_init_groc(
    mock_os_path_isdir, mock_create_setup_db,
    mock_create_connection, mock_os_path_expanduser
):
    g = Groc()
    g.init_groc()
    assert mock_create_setup_db.called
Esempio n. 2
0
def test_init_groc_raise_exception(
    mock_create_setup_db, mock_os_path_isfile,
    mock_create_connection, mock_os_path_expanduser
):
    g = Groc()
    with pytest.raises(exceptions.DatabaseError):
        g.init_groc()
    assert not mock_create_setup_db.called
Esempio n. 3
0
def test_init_groc_2(
    mock_os_mkdir, mock_os_path_isdir,
    mock_create_setup_db, mock_create_connection, mock_os_path_expanduser
):
    g = Groc()
    g.init_groc()
    assert g.groc_dir == 'my-groc-dir'
    assert mock_os_mkdir.called
    mock_os_mkdir.assert_called_with('my-groc-dir')