-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
路27 lines (20 loc) 路 877 Bytes
/
Copy pathtest.py
File metadata and controls
executable file
路27 lines (20 loc) 路 877 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
#!/usr/bin/env python
from subprocess import check_output
import unittest
import os
from pwd import getpwnam
class TestWorkstation(unittest.TestCase):
def test_workstation_user(self):
check_output('id $WORKSTATION_USER', shell=True)
def test_file_permissions(self):
workstation_user = os.environ.get('WORKSTATION_USER')
workstation_user_uid = getpwnam(workstation_user)
def assertOwnedByWorkstationUser(path):
result = os.stat(os.path.expanduser(path.format(user=workstation_user)))
self.assertEquals(result.st_uid, workstation_user_uid.pw_uid)
assertOwnedByWorkstationUser("~{user}/.editorconfig")
assertOwnedByWorkstationUser("~{user}/.bashrc")
def test_vim(self):
check_output('vim --version | grep "+visualextra"', shell=True)
if __name__ == '__main__':
unittest.main()