This repository was archived by the owner on May 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathtests.py
More file actions
31 lines (22 loc) · 1.3 KB
/
tests.py
File metadata and controls
31 lines (22 loc) · 1.3 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
import unittest
import json
from app import PerforceLogger
class BaseTest(unittest.TestCase):
def test_check_for_changes_save(self):
logger = PerforceLogger('webhook_url')
# Initial change check should save the payload.
logger.check_for_changes('Change num on date hh:mm:ss by user@client [status] description')
self.assertEqual(logger.global_store['latest_change'], 'Change num on date hh:mm:ss by user@client [status] description')
# Additional updates should change the store.
logger.check_for_changes('Payload should change')
self.assertEqual(logger.global_store['latest_change'], 'Payload should change')
def test_check_for_changes_return(self):
logger = PerforceLogger('webhook_url')
self.assertEqual(logger.check_for_changes('Payload should return'), 'Payload should return')
# The payload should return empty as it's the same change as the previous one.
self.assertEqual(logger.check_for_changes('Payload should return'), '')
# Should properly throw out **pending** payloads.
self.assertEqual(logger.check_for_changes('Payload should return empty as its **pending**'), '')
self.assertEqual(logger.check_for_changes('Payload should return data as its **new**'), 'Payload should return data as its **new**')
if __name__ == '__main__':
unittest.main()