def test_create_db_copy_invalid_parameter_names(create_mozilla_data):
    table = Table(
        table='moz_places',
        path=create_mozilla_data,
        browser=None,
        filename=None,
        profile=None,
        copies_subpath='.',
    )
    with pytest.raises(TypeError):
        table._create_db_copy()
def test_create_db_copy(create_mozilla_data):
    with tempfile.TemporaryDirectory() as tempdir:
        table = Table(
            table='moz_places',
            path=create_mozilla_data,
            browser='mozilla',
            filename='anything',
            profile='test',
            copies_subpath=tempdir,
        )
        filename = Path(create_mozilla_data).name
        expected_dst = Path(table.copies_subpath, 'AppData', 'Profile Copies',
                            table.browser, table.profile,
                            filename).expanduser()
        table._create_db_copy()
        assert table.path == expected_dst
        assert filecmp.cmp(expected_dst, table.path)
def test_create_db_copy_invalid_FileNotFoundError(create_invalid_filepath):
    with tempfile.TemporaryDirectory() as tempdir:
        table = Table(
            table='some_table',
            path=create_invalid_filepath,
            browser='mozilla',
            filename='anything',
            profile='test',
            copies_subpath=tempdir,
        )
        excep = table._create_db_copy()
        assert isinstance(excep, FileNotFoundError)