forked from roopeshvaddepally/python-ebay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_finding.py
117 lines (100 loc) · 4.87 KB
/
test_finding.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import unittest
from lxml import etree
from ebay.finding import *
encoding = "XML"
keywords = "ipod"
categoryId = "12"
productId = "1"
storeName = "store1"
affiliate = {"key":"value", "key2":"value"}
buyerPostalCode = "95112"
paginationInput = {"key":"value", "key2":"value"}
itemFilter = [{"key":"value", "key2":"value2"}, {"key3":"value3", "key4":"value4"}]
sortOrder = "so"
aspectFilter = [{"key":"value", "key2":"value2"}, {"key3":"value3", "key4":"value4"}]
domainFilter = [{"key":"value", "key2":"value2"}, {"key3":"value3", "key4":"value4"}]
outputSelector =["os1", "os2", "os3"]
class TestFindingApi(unittest.TestCase):
def test_getSearchKeywordsRecommendation(self):
result = getSearchKeywordsRecommendation(keywords=keywords, encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Warning")
def test_findItemsByKeywords(self):
result = findItemsByKeywords(keywords=keywords, \
affiliate=affiliate, \
buyerPostalCode=buyerPostalCode, \
paginationInput=paginationInput, \
sortOrder=sortOrder, \
aspectFilter=aspectFilter, \
domainFilter=domainFilter, \
itemFilter=itemFilter, \
outputSelector=outputSelector, \
encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Success")
def test_findItemsByCategory(self):
result = findItemsByCategory(categoryId=categoryId, \
affiliate=affiliate, \
buyerPostalCode=buyerPostalCode, \
sortOrder=sortOrder, \
paginationInput = paginationInput, \
aspectFilter=aspectFilter, \
domainFilter=domainFilter, \
itemFilter=itemFilter, \
outputSelector=outputSelector, \
encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Success")
def test_findItemsAdvanced(self):
result = findItemsAdvanced(keywords=keywords, \
categoryId=categoryId, \
affiliate=affiliate, \
buyerPostalCode=buyerPostalCode, \
paginationInput= paginationInput, \
sortOrder=sortOrder, \
aspectFilter=aspectFilter, \
domainFilter=domainFilter, \
itemFilter=itemFilter, \
outputSelector=outputSelector, \
encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Success")
def test_findItemsByProduct(self):
result = findItemsByProduct(keywords=keywords, \
productId=productId, \
affiliate=affiliate, \
buyerPostalCode=buyerPostalCode, \
paginationInput= paginationInput, \
sortOrder=sortOrder, \
itemFilter=itemFilter, \
outputSelector=outputSelector, \
encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Failure")
def test_findItemsIneBayStores(self):
result = findItemsIneBayStores(keywords=keywords, \
storeName=storeName, \
affiliate=affiliate, \
buyerPostalCode=buyerPostalCode, \
paginationInput=paginationInput, \
sortOrder=sortOrder, \
aspectFilter=aspectFilter, \
domainFilter=domainFilter, \
itemFilter=itemFilter, \
outputSelector=outputSelector, \
encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Success")
def test_getHistograms(self):
result = getHistograms(categoryId=categoryId, encoding=encoding)
root = etree.fromstring(result)
ack = root.find("{http://www.ebay.com/marketplace/search/v1/services}ack").text
self.assertEqual(ack, "Success")
if __name__ == '__main__':
unittest.main()