forked from ej2/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_batchrequest.py
More file actions
65 lines (46 loc) · 1.85 KB
/
test_batchrequest.py
File metadata and controls
65 lines (46 loc) · 1.85 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
import unittest
from quickbooks.objects.batchrequest import Fault, FaultError, BatchItemResponse, BatchItemRequest
class FaultTests(unittest.TestCase):
def test__repr__(self):
fault = Fault()
fault.type = "test"
fault.original_object = 100
fault.Error.append("error")
self.assertEquals(str(fault.__repr__()), "1 Errors")
class FaultErrorTests(unittest.TestCase):
def test_unicode(self):
fault_error = FaultError()
fault_error.Message = "test"
fault_error.code = 100
fault_error.Detail = "detail"
self.assertEquals(str(fault_error), "Code: 100 Message: test Detail: detail")
def test__repr__(self):
fault_error = FaultError()
fault_error.Message = "test"
fault_error.code = 100
fault_error.Detail = "detail"
self.assertEquals(fault_error.__repr__(), "Code: 100 Message: test Detail: detail")
class BatchItemResponseTests(unittest.TestCase):
def test_set_object(self):
obj = FaultError()
batch_item = BatchItemResponse()
batch_item.set_object(obj)
self.assertEquals(batch_item._original_object, obj)
self.assertEquals(batch_item.Error, obj)
def test_get_object(self):
obj = Fault()
batch_item = BatchItemResponse()
batch_item.set_object(obj)
self.assertEquals(batch_item.get_object(), obj)
class BatchItemRequestTests(unittest.TestCase):
def test_set_object(self):
obj = FaultError()
batch_item = BatchItemRequest()
batch_item.set_object(obj)
self.assertEquals(batch_item._original_object, obj)
self.assertEquals(batch_item.Error, obj)
def test_get_object(self):
obj = Fault()
batch_item = BatchItemRequest()
batch_item.set_object(obj)
self.assertEquals(batch_item.get_object(), obj)