Exemple #1
0
def test_duplicate_genre(factory: Factory, db: Connection):
    rls = factory.release(conn=db)

    _insert_into_genre_collections(rls, ["1, 2, 3", "2/3"], db)
    collections = release.collections(rls, db)
    for genre in ["1", "2", "3"]:
        col = collection.from_name_type_user(genre, CollectionType.GENRE, db)
        assert col in collections
Exemple #2
0
def resolve_collages(obj: release.T,
                     info: GraphQLResolveInfo) -> list[collection.T]:
    return release.collections(obj,
                               info.context.db,
                               type=CollectionType.COLLAGE)
Exemple #3
0
def resolve_labels(obj: release.T,
                   info: GraphQLResolveInfo) -> list[collection.T]:
    return release.collections(obj, info.context.db, type=CollectionType.LABEL)
Exemple #4
0
def test_insert_into_genre_collections_nothing(factory: Factory,
                                               db: Connection):
    rls = factory.release(conn=db)
    _insert_into_genre_collections(rls, ["  "], db)
    assert not release.collections(rls, db)
Exemple #5
0
def test_insert_into_genre_preexisting(factory: Factory, db: Connection):
    rls = factory.release(conn=db)
    col = factory.collection(type=CollectionType.GENRE, conn=db)

    _insert_into_genre_collections(rls, [col.name], db)
    assert collection.from_id(col.id, db) in release.collections(rls, db)
Exemple #6
0
def test_insert_into_label_collection_new(factory: Factory, db: Connection):
    rls = factory.release(conn=db)
    _insert_into_label_collection(rls, "asdf", db)
    col = collection.from_name_type_user("asdf", CollectionType.LABEL, db)
    assert col in release.collections(rls, db)
Exemple #7
0
def test_insert_into_label_collection_existing(factory: Factory,
                                               db: Connection):
    rls = factory.release(conn=db)
    col = factory.collection(type=CollectionType.LABEL, conn=db)
    _insert_into_label_collection(rls, col.name, db)
    assert collection.from_id(col.id, db) in release.collections(rls, db)
Exemple #8
0
def test_insert_into_label_collection_nonexistent(factory: Factory,
                                                  db: Connection):
    rls = factory.release(conn=db)
    _insert_into_label_collection(rls, "", db)
    assert not release.collections(rls, db)