Skip to content

Commit 6b4f894

Browse files
committed
Add tests
1 parent b1a5aab commit 6b4f894

File tree

4 files changed

+591
-0
lines changed

4 files changed

+591
-0
lines changed

tests/test_exceptions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from picketapi import exceptions
2+
3+
4+
def test_picket_api_exception():
5+
assert exceptions.PicketAPIException is not None
6+
7+
8+
def test_picket_api_exception_init():
9+
msg = "msg"
10+
code = "code"
11+
exception = exceptions.PicketAPIException(msg, code)
12+
assert exception.msg == msg
13+
assert exception.code == code
14+
15+
16+
def test_picket_api_exception_str():
17+
msg = "msg"
18+
code = "code"
19+
exception = exceptions.PicketAPIException(msg, code)
20+
assert str(exception) == msg

tests/test_helpers.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from picketapi import helpers
2+
3+
4+
def test_is_successful_status_code_true():
5+
assert helpers.is_successful_status_code(201) is True
6+
7+
8+
def test_is_successful_status_code_false():
9+
assert helpers.is_successful_status_code(400) is False
10+
11+
12+
def test_snake_to_camel():
13+
assert helpers.snake_to_camel("snake_to_camel") == "snakeToCamel"
14+
assert helpers.snake_to_camel("wallet_address") == "walletAddress"
15+
assert helpers.snake_to_camel("contract_address") == "contractAddress"
16+
assert helpers.snake_to_camel("token_ids") == "tokenIds"
17+
18+
19+
def test_snake_to_camel_keys():
20+
d = {"snake_to_camel": "snake_to_camel", "wallet_address": "wallet_address"}
21+
assert helpers.snake_to_camel_keys(d) == {
22+
"snakeToCamel": "snake_to_camel",
23+
"walletAddress": "wallet_address",
24+
}

0 commit comments

Comments
 (0)