Skip to content

Commit

Permalink
test publish but draft not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdihaghverdi committed Feb 20, 2024
1 parent b71e355 commit 61c1b04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,3 @@ repos:
- id: ruff
args:
- --fix

- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ pytest = "^7.4.4"
pytest-cov = "^4.1.0"
aiosqlite = "^0.19.0"

[tool.black]
line-length = 90

[tool.ruff]
line-length = 90
ignore = ["E711", "D100", "D101", "D102", "D103", "D105", "T201", "ANN101"]
Expand Down
10 changes: 10 additions & 0 deletions tests/test_drafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def test_publish_post(client, mahdi_auth_headers):
json={"title": "title", "body": "body"},
headers=mahdi_auth_headers,
).json()["id"]

response = client.post(
f"{drafts_url}/publish/{draft_id}",
json={"tags": ["tag1", "tag2"], "slug": "my slug"},
Expand Down Expand Up @@ -174,3 +175,12 @@ def test_draft_published_before(client, mahdi_auth_headers):
headers=mahdi_auth_headers,
)
assert response.status_code == 400, response.text


def test_publish_but_draft_not_found(client, mahdi_auth_headers):
response = client.post(
f"{drafts_url}/publish/1",
json={"tags": ["tag1", "tag2"], "slug": "my slug"},
headers=mahdi_auth_headers,
)
assert response.status_code == 404, response.text

0 comments on commit 61c1b04

Please sign in to comment.