-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.py
More file actions
90 lines (63 loc) · 2.26 KB
/
tests.py
File metadata and controls
90 lines (63 loc) · 2.26 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import googleplaystore
import json
import os
import json
import unittest
import collections
__author__ = 'Javier Chavez'
__email__ = 'javierc@cs.unm.edu'
class GooglePlayStoreAPITestCase(unittest.TestCase):
def setUp(self):
default_value = ''
# get the vars defined in bashrc
cookie = {
"PLAY_PREFS": os.getenv('PLAY_PREFS', default_value),
"NID": os.getenv('NID', default_value),
"_gat": os.getenv('GAT', default_value),
"_ga": os.getenv('_GA', default_value)
}
# init google play store api
self.ps = googleplaystore.PlayStore(cookie=cookie)
def test_search_return(self):
searchcls = self.ps.search('google', 1)
#self.assertGreater(len(apps), 0)
self.assertTrue(isinstance(searchcls, googleplaystore.Search))
def test_app_return(self):
appcls = self.ps.get_app('com.twitter.android')
self.assertTrue(isinstance(appcls, googleplaystore.App))
def test_app_feilds(self):
app = self.ps.get_app('com.twitter.android')
app.populate_fields()
_feilds = ['url',
'name',
'developer',
'package',
'description',
'icon',
'price',
'pub_date',
'category'
]
for field in _feilds:
self.assertTrue(app[field])
def test_app_exclude_feilds(self):
app = self.ps.get_app('com.twitter.android')
app.populate_fields(exclude=
['permissions',
'developer',
'icon',
'description',
'screenshots'])
_feilds = ['permissions',
'developer',
'screenshots',
'description',
'icon',
]
for field in _feilds:
self.assertFalse(app[field])
# def test_app_permissions(self):
# app = self.ps.get_app('com.twitter.android')
# app.populate_fields()
if __name__ == '__main__':
unittest.main()