Skip to content

Commit

Permalink
add recorded client unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdagger committed Oct 16, 2023
1 parent fccf292 commit 2eb4496
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import pytest

from zammadoo import APIException


def test_server_version(rclient):
version = rclient.server_version.split(".")
assert version[:2] == ["6", "1"]


def test_raise_if_user_cannot_be_found(rclient):
with pytest.raises(APIException) as exc:
rclient.users(100).reload()

assert exc.match("Couldn't find User")
assert exc.value.response.status_code == 404
1 change: 1 addition & 0 deletions tests/test_client/test_raise_if_user_cannot_be_found.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GET https://localhost/api/v1/users/100 404 {"error":"Couldn't find User with 'id'=100","error_human":"Couldn't find User with 'id'=100"}
1 change: 0 additions & 1 deletion tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from weakref import getweakrefcount, ref

import pytest

from conftest import resource


Expand Down

0 comments on commit 2eb4496

Please sign in to comment.