This repository was archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathrun_service_tests.py
executable file
·105 lines (97 loc) · 3.88 KB
/
run_service_tests.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
#!/usr/bin/python
import sys
import unittest
import module_test_runner
import getopt
import getpass
# Modules whose tests we will run.
import atom_tests.service_test
import gdata_tests.service_test
import gdata_tests.apps.service_test
import gdata_tests.calendar.service_test
import gdata_tests.docs.service_test
import gdata_tests.spreadsheet.service_test
import gdata_tests.spreadsheet.text_db_test
import gdata_tests.photos.service_test
import gdata_tests.contacts.service_test
import gdata_tests.blogger.service_test
import gdata_tests.youtube.service_test
import gdata_tests.contacts.profiles.service_test
def RunAllTests(username, password, spreadsheet_key, worksheet_key,
apps_username, apps_password, apps_domain):
test_runner = module_test_runner.ModuleTestRunner()
test_runner.modules = [atom_tests.service_test,
gdata_tests.service_test,
gdata_tests.apps.service_test,
gdata_tests.calendar.service_test,
gdata_tests.docs.service_test,
gdata_tests.spreadsheet.service_test,
gdata_tests.spreadsheet.text_db_test,
gdata_tests.contacts.service_test,
gdata_tests.youtube.service_test,
gdata_tests.photos.service_test,
gdata_tests.contacts.profiles.service_test,]
test_runner.settings = {'username':username, 'password':password,
'test_image_location':'testimage.jpg',
'ss_key':spreadsheet_key,
'ws_key':worksheet_key,
'apps_username':apps_username,
'apps_password':apps_password,
'apps_domain':apps_domain}
test_runner.RunAllTests()
def GetValuesForTestSettingsAndRunAllTests():
username = ''
password = ''
spreadsheet_key = ''
worksheet_key = ''
apps_domain = ''
apps_username = ''
apps_password = ''
print ('NOTE: Please run these tests only with a test account. '
'The tests may delete or update your data.')
try:
opts, args = getopt.getopt(sys.argv[1:], '', ['username=', 'password=',
'ss_key=', 'ws_key=',
'apps_username=',
'apps_password=',
'apps_domain='])
for o, a in opts:
if o == '--username':
username = a
elif o == '--password':
password = a
elif o == '--ss_key':
spreadsheet_key = a
elif o == '--ws_key':
worksheet_key = a
elif o == '--apps_username':
apps_username = a
elif o == '--apps_password':
apps_password = a
elif o == '--apps_domain':
apps_domain = a
except getopt.GetoptError:
pass
if username == '' and password == '':
print ('Missing --user and --pw command line arguments, '
'prompting for credentials.')
if username == '':
username = raw_input('Please enter your username: ')
if password == '':
password = getpass.getpass()
if spreadsheet_key == '':
spreadsheet_key = raw_input(
'Please enter the key for the test spreadsheet: ')
if worksheet_key == '':
worksheet_key = raw_input(
'Please enter the id for the worksheet to be edited: ')
if apps_username == '':
apps_username = raw_input('Please enter your Google Apps admin username: ')
if apps_password == '':
apps_password = getpass.getpass()
if apps_domain == '':
apps_domain = raw_input('Please enter your Google Apps domain: ')
RunAllTests(username, password, spreadsheet_key, worksheet_key,
apps_username, apps_password, apps_domain)
if __name__ == '__main__':
GetValuesForTestSettingsAndRunAllTests()