forked from wizelineacademy/sre-bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
18 lines (12 loc) · 678 Bytes
/
tests.py
File metadata and controls
18 lines (12 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest
from methods import Token, Restricted
class TestStringMethods(unittest.TestCase):
def setUp(self):
self.convert = Token()
self.validate = Restricted()
def test_generate_token(self):
self.assertEqual('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4ifQ.StuYX978pQGnCeeaj2E1yBYwQvZIodyDTCJWXdsxBGI', self.convert.generate_token('admin', 'secret'))
def test_access_data(self):
self.assertEqual('You are under protected data', self.validate.access_data('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4ifQ.StuYX978pQGnCeeaj2E1yBYwQvZIodyDTCJWXdsxBGI'))
if __name__ == '__main__':
unittest.main()