-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
30 lines (20 loc) · 778 Bytes
/
Copy pathtests.py
File metadata and controls
30 lines (20 loc) · 778 Bytes
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
from os import listdir, path
import unittest
import uuid
from server import execute
user = [None]
username = uuid.uuid1()
password = uuid.uuid4()
execute(user, f'register {username} {password}')
class ExecutionTester(unittest.TestCase):
def test_step1_read_write(self):
execute(user, 'write_file saikumar.txt Hello!!Everyone.')
output = execute(user, 'read_file saikumar.txt')
self.assertEqual(output, 'Hello!!Everyone.')
def test_step2_list(self):
output = execute(user, 'list')
self.assertEqual(output, '\n'.join(listdir(f'./users/{user[0]}')))
def test_step3_create_folder(self):
execute(user, 'create_folder sai_kumar')
self.assertTrue(path.isdir(f'./users/{user[0]}/sai_kumar'))
unittest.main()