Beispiel #1
0
def create_collection(
        *,
        _: bool = Depends(is_authenticated),
        repository: CollectionRepository = Depends(get_collection_repository),
        collection: CollectionUpdate):
    db_collection: DBCollection = DBCollection(**collection.dict())
    return repository.add(db_collection)
Beispiel #2
0
def update_collection(
        *,
        _: bool = Depends(is_authenticated),
        repository: CollectionRepository = Depends(get_collection_repository),
        id: int,
        collection_update: CollectionUpdate):
    db_collection: DBCollection = or_404(repository.get(id))
    updated: DBCollection = repository.update(
        db_collection, collection_update.dict(skip_defaults=True))
    return updated
Beispiel #3
0
def update_collection(
    *,
    _: bool = Depends(is_authenticated),
    repository: CollectionRepository = Depends(get_collection_repository),
    id: int,
    collection_update: CollectionUpdate,
):
    db_collection: DBCollection = or_404(repository.get(id))
    updated: DBCollection = repository.update(
        db_collection, collection_update.dict(exclude_unset=True))
    return updated.to_model()
Beispiel #4
0
    name="Single Class Lib Method 3",
    tags=[],
)
EXPECTED_COLLECTION_KEYWORDS_1 = [
    EXPECTED_COLLECTION_KEYWORDS_1_1,
    EXPECTED_COLLECTION_KEYWORDS_1_2,
    EXPECTED_COLLECTION_KEYWORDS_1_3,
]
EXISTING_COLLECTION_KEYWORDS = [
    NestedKeyword(**{
        **EXPECTED_COLLECTION_KEYWORDS_1_3.dict(), "id": 1
    })
]
EXISTING_COLLECTION = Collection(
    **{
        **EXPECTED_COLLECTION.dict(),
        "id":
        1,
        "keywords": [
            NestedKeyword(**{
                **EXPECTED_COLLECTION_KEYWORDS_1_3.dict(), "id": 1
            })
        ],
    })
EXPECTED_COLLECTION_2 = CollectionUpdate(
    doc="Documentation for library ``Test Libdoc File``.",
    doc_format="ROBOT",
    name="Test Libdoc File",
    path=str(FIXTURE_PATH / "test_libdoc_file.xml"),
    scope="GLOBAL",
    type="LIBRARY",