Skip to content

Commit 21820bf

Browse files
authored
Merge pull request #25 from Leop0ld/master
Test case 추가
2 parents bfa40a1 + 7d3b312 commit 21820bf

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/test_cancel.py

+26
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,32 @@ def test_cancel_by_merchant_uid(iamport):
3535
assert e.message == u'취소할 결제건이 존재하지 않습니다.'
3636

3737

38+
def test_cancel_without_merchant_uid(iamport):
39+
payload = {
40+
'merchant_uid': None,
41+
'reason': 'any-reason',
42+
}
43+
44+
try:
45+
iamport.cancel(**payload)
46+
except KeyError as e:
47+
assert 'merchant_uid or imp_uid is required' in str(e)
48+
49+
50+
def test_cancel_by_merchant_uid_with_kwargs(iamport):
51+
payload = {
52+
'merchant_uid': 'any-merchant_uid',
53+
'reason': 'any-reason',
54+
'amount': 1234,
55+
}
56+
57+
try:
58+
iamport.cancel(**payload)
59+
except iamport.ResponseError as e:
60+
assert e.code == 1
61+
assert e.message == u'취소할 결제건이 존재하지 않습니다.'
62+
63+
3864
def test_cancel_by_imp_uid(iamport):
3965
payload = {
4066
'imp_uid': 'any-imp_uid',

tests/test_is_paid.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
def test_is_paid_with_response(iamport):
5+
mocked_response = {
6+
'status': 'paid',
7+
'amount': 1000,
8+
}
9+
assert True is iamport.is_paid(amount=1000, resposne=mocked_response, merchant_uid='test')
10+
11+
12+
def test_is_paid_without_response(iamport):
13+
assert False is iamport.is_paid(amount=1000, merchant_uid='qwer1234')

0 commit comments

Comments
 (0)