-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
57 lines (51 loc) · 2.02 KB
/
test.py
File metadata and controls
57 lines (51 loc) · 2.02 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
import os
import unittest
import pypaste.__main__ as paste
class TestSum(unittest.TestCase):
PASTEBIN_DEV_KEY = os.getenv('PASTEBIN_DEV_KEY')
PASTEBIN_USER_KEY = os.getenv('PASTEBIN_USER_KEY')
def testPaste(self):
self.assertEqual(paste.main(), 0, 'Should be zero.')
'''def testPrivate(self):
payload = {'api_option': 'paste',
'api_dev_key': self.PASTEBIN_DEV_KEY,
'api_paste_code': 'TESTING',
'api_paste_expire_date': '10M',
'api_paste_name': '',
'api_paste_private': '2',
'api_user_key': self.PASTEBIN_USER_KEY
}
self.assertEqual(paste.post(payload), 0, 'Private post failed.')
'''
def testUnlisted(self):
payload = {'api_option': 'paste',
'api_dev_key': self.PASTEBIN_DEV_KEY,
'api_paste_code': 'TESTING',
'api_paste_expire_date': '10M',
'api_paste_name': '',
'api_paste_private': '1'
}
self.assertEqual(paste.post(payload), 0, 'Unlisted post failed.')
def testTitle(self):
payload = {'api_option': 'paste',
'api_dev_key': self.PASTEBIN_DEV_KEY,
'api_paste_code': 'TESTING',
'api_paste_expire_date': '10M',
'api_paste_name': 'TEST TITLE',
'api_paste_private': '1'
}
self.assertEqual(paste.post(payload), 0, 'Titled post failed.')
'''def testExpiration(self):
expirations = ['N','10M','1H','1D','1W','2W','1M','6M','1Y']
for expiration in expirations:
payload = {'api_option': 'paste',
'api_dev_key': self.PASTEBIN_DEV_KEY,
'api_paste_code': 'TESTING EXPIRATION',
'api_paste_expire_date': expiration,
'api_paste_name': '',
'api_paste_private': '1'
}
self.assertEqual(paste.post(payload), 0, 'Post with expiration {} failed.'.format(expiration))
'''
if __name__ == '__main__':
unittest.main()