def test_fetch_assoc_col(monkeypatch, setup_mdb_dir):
    tmpdir = setup_mdb_dir
    os.chdir(tmpdir)
    mdb_file = os.path.join(TESTS_DIR, 'all_test_files', 'manga_db.sqlite.sql')
    memdb = load_db_from_sql_file(mdb_file, ':memory:', True)
    monkeypatch.setattr('manga_db.manga_db.MangaDB._load_or_create_sql_db', (lambda x, y, z: (memdb, None)))
    mdb = MangaDB(tmpdir, mdb_file)
    b = Book(mdb, in_db=False, id=14)
    tags = ['Ahegao', 'Anal', 'Collar', 'Large Breasts', 'Maid', 'Mind Break', 'Mind Control', 'Nakadashi', 'Office Lady', 'Pantyhose', 'Rape', 'Stockings', 'X-ray']
    assert (sorted(b._fetch_associated_column('tag')) == sorted(tags))
    assert (b._fetch_associated_column('character') == [])
    assert (b._fetch_associated_column('artist') == ['Fan no Hitori'])
def test_fetch_assoc_col(monkeypatch, setup_mdb_dir):
    tmpdir = setup_mdb_dir
    os.chdir(tmpdir)
    mdb_file = os.path.join(TESTS_DIR, 'all_test_files', 'manga_db.sqlite.sql')
    memdb = load_db_from_sql_file(mdb_file, ':memory:', True)
    monkeypatch.setattr('manga_db.manga_db.MangaDB._load_or_create_sql_db', (lambda x, y, z: (memdb, None)))
    mdb = MangaDB(tmpdir, mdb_file)
    b = Book(mdb, in_db=False, id=14)
    tags = ['Ahegao', 'Anal', 'Collar', 'Large Breasts', 'Maid', 'Mind Break', 'Mind Control', 'Nakadashi', 'Office Lady', 'Pantyhose', 'Rape', 'Stockings', 'X-ray']
    assert (sorted(b._fetch_associated_column('tag')) == sorted(tags))
    assert (b._fetch_associated_column('character') == [])
    assert (b._fetch_associated_column('artist') == ['Fan no Hitori'])