test_python_application.py (1695:48cd8f20dea4) test_python_application.py (1706:a1da56837554)
1import grp
2import pwd
3import re
4import time
5
6import pytest
7
8from conftest import option

--- 716 unchanged lines hidden (view full) ---

725 pytest.skip('requires root')
726
727 nobody_uid = pwd.getpwnam('nobody').pw_uid
728
729 group = 'nobody'
730
731 try:
732 group_id = grp.getgrnam(group).gr_gid
1import grp
2import pwd
3import re
4import time
5
6import pytest
7
8from conftest import option

--- 716 unchanged lines hidden (view full) ---

725 pytest.skip('requires root')
726
727 nobody_uid = pwd.getpwnam('nobody').pw_uid
728
729 group = 'nobody'
730
731 try:
732 group_id = grp.getgrnam(group).gr_gid
733 except:
733 except KeyError:
734 group = 'nogroup'
735 group_id = grp.getgrnam(group).gr_gid
736
737 self.load('user_group')
738
739 obj = self.getjson()['body']
740 assert obj['UID'] == nobody_uid, 'nobody uid'
741 assert obj['GID'] == group_id, 'nobody gid'

--- 28 unchanged lines hidden (view full) ---

770 assert obj['UID'] == 0, 'root uid user=root'
771 assert obj['GID'] == 0, 'root gid user=root'
772
773 group = 'root'
774
775 try:
776 grp.getgrnam(group)
777 group = True
734 group = 'nogroup'
735 group_id = grp.getgrnam(group).gr_gid
736
737 self.load('user_group')
738
739 obj = self.getjson()['body']
740 assert obj['UID'] == nobody_uid, 'nobody uid'
741 assert obj['GID'] == group_id, 'nobody gid'

--- 28 unchanged lines hidden (view full) ---

770 assert obj['UID'] == 0, 'root uid user=root'
771 assert obj['GID'] == 0, 'root gid user=root'
772
773 group = 'root'
774
775 try:
776 grp.getgrnam(group)
777 group = True
778 except:
778 except KeyError:
779 group = False
780
781 if group:
782 self.load('user_group', user='root', group='root')
783
784 obj = self.getjson()['body']
785 assert obj['UID'] == 0, 'root uid user=root group=root'
786 assert obj['GID'] == 0, 'root gid user=root group=root'

--- 57 unchanged lines hidden ---
779 group = False
780
781 if group:
782 self.load('user_group', user='root', group='root')
783
784 obj = self.getjson()['body']
785 assert obj['UID'] == 0, 'root uid user=root group=root'
786 assert obj['GID'] == 0, 'root gid user=root group=root'

--- 57 unchanged lines hidden ---