Skip to content

Commit

Permalink
Категории в паблик доступ (#18)
Browse files Browse the repository at this point in the history
* open category

* open category
  • Loading branch information
grigoriev-semyon committed Aug 26, 2023
1 parent 51e9f1b commit 1a84a14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 0 additions & 2 deletions tests/test_routes/test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def test_create_with_no_scopes(client, dbsession):
dbsession.commit()


@pytest.mark.authenticated()
def test_get(client, dbsession, category):
_category = category()
response = client.get(f"/category/{_category.id}")
Expand All @@ -49,7 +48,6 @@ def test_get(client, dbsession, category):
assert response.json()["name"] == _category.name


@pytest.mark.authenticated()
def test_get_all(client, dbsession, category):
category1 = category()
category2 = category()
Expand Down
10 changes: 2 additions & 8 deletions userdata_api/routes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ async def create_category(


@category.get("/{id}", response_model=CategoryGet)
async def get_category(
id: int,
_: dict[str, str] = Depends(UnionAuth(scopes=[], allow_none=False, auto_error=True)),
) -> CategoryGet:
async def get_category(id: int) -> CategoryGet:
"""
Получить категорию
:param id: Айди категории
Expand All @@ -50,10 +47,7 @@ async def get_category(


@category.get("", response_model=list[CategoryGet], response_model_exclude_none=True)
async def get_categories(
query: list[Literal["param"]] = Query(default=[]),
_: dict[str, str] = Depends(UnionAuth(scopes=[], allow_none=False, auto_error=True)),
) -> list[CategoryGet]:
async def get_categories(query: list[Literal["param"]] = Query(default=[])) -> list[CategoryGet]:
result = []
for category in Category.query(session=db.session).all():
to_append = category.dict()
Expand Down

0 comments on commit 1a84a14

Please sign in to comment.