forked from FeeFighters/samurai-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_message.py
More file actions
executable file
·70 lines (59 loc) · 2.77 KB
/
test_message.py
File metadata and controls
executable file
·70 lines (59 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import unittest
from samurai.message import Message
class TestMessage(unittest.TestCase):
def test_transaction_success(self):
message = Message(subclass='info',
context='processor.transaction',
key='success')
self.assertEqual(message.description,
'The transaction was successful.')
def test_transaction_declined(self):
message = Message(subclass='error',
context='processor.transaction',
key='declined')
self.assertEqual(message.description,
'The card was declined.')
def test_issuer_call(self):
message = Message(subclass='error',
context='processor.issuer',
key='call')
self.assertEqual(message.description,
'Call the card issuer for further instructions.')
def test_issuer_unavailable(self):
message = Message(subclass='error',
context='processor.issuer',
key='unavailable')
self.assertEqual(message.description,
'The authorization did not respond within the alloted time.')
def test_card_invalid(self):
message = Message(subclass='error',
context='input.card_number',
key='invalid')
self.assertEqual(message.description,
'The card number was invalid.')
def test_expiry_month_invalid(self):
message = Message(subclass='error',
context='input.expiry_month',
key='invalid')
self.assertEqual(message.description,
'The expiration date month was invalid, or prior to today.')
def test_expiry_year_invalid(self):
message = Message(subclass='error',
context='input.expiry_year',
key='invalid')
self.assertEqual(message.description,
'The expiration date year was invalid, or prior to today.')
def test_amount_invalid(self):
message = Message(subclass='error',
context='input.amount',
key='invalid')
self.assertEqual(message.description,
'The transaction amount was invalid.')
def test_insufficient_funds(self):
message = Message(subclass='error',
context='processor.transaction',
key='declined_insufficient_funds')
self.assertEqual(message.description,
'The transaction was declined due to insufficient funds.')
if __name__ == '__main__':
unittest.main()