Example #1
0
 def test_setgroups_raises_ESRCH(self, hack, sysconf, getgroups):
     sysconf.side_effect = ValueError()
     esrch = OSError()
     esrch.errno = errno.ESRCH
     hack.side_effect = esrch
     with self.assertRaises(OSError):
         setgroups(list(range(400)))
Example #2
0
 def test_setgroups_raises_ESRCH(self, hack, getgroups):
     with patch('os.sysconf') as sysconf:
         sysconf.side_effect = ValueError()
         esrch = OSError()
         esrch.errno = errno.ESRCH
         hack.side_effect = esrch
         with pytest.raises(OSError):
             setgroups(list(range(400)))
Example #3
0
    def test_setgroups_raises_EPERM(self, hack, sysconf, getgroups):
        sysconf.side_effect = ValueError()
        eperm = OSError()
        eperm.errno = errno.EPERM
        hack.side_effect = eperm
        getgroups.return_value = list(range(400))
        setgroups(list(range(400)))
        getgroups.assert_called_with()

        getgroups.return_value = [1000]
        with self.assertRaises(OSError):
            setgroups(list(range(400)))
        getgroups.assert_called_with()
Example #4
0
 def test_setgroups_sysconf_raises(self, hack, sysconf):
     sysconf.side_effect = ValueError()
     setgroups(list(range(400)))
     hack.assert_called_with(list(range(400)))
Example #5
0
 def test_setgroups(self, hack, sysconf):
     sysconf.return_value = 100
     setgroups(list(range(400)))
     hack.assert_called_with(list(range(100)))
Example #6
0
 def test_setgroups_sysconf_raises(self, hack):
     with patch('os.sysconf') as sysconf:
         sysconf.side_effect = ValueError()
         setgroups(list(range(400)))
         hack.assert_called_with(list(range(400)))
Example #7
0
 def test_setgroups(self, hack):
     with patch('os.sysconf') as sysconf:
         sysconf.return_value = 100
         setgroups(list(range(400)))
         hack.assert_called_with(list(range(100)))
Example #8
0
 def test_setgroups_sysconf_raises(self, hack):
     with patch('os.sysconf') as sysconf:
         sysconf.side_effect = ValueError()
         setgroups(list(range(400)))
         hack.assert_called_with(list(range(400)))
Example #9
0
 def test_setgroups(self, hack):
     with patch('os.sysconf') as sysconf:
         sysconf.return_value = 100
         setgroups(list(range(400)))
         hack.assert_called_with(list(range(100)))
Example #10
0
 def test_setgroups_sysconf_raises(self, hack, sysconf):
     sysconf.side_effect = ValueError()
     setgroups(list(range(400)))
     hack.assert_called_with(list(range(400)))
Example #11
0
 def test_setgroups(self, hack, sysconf):
     sysconf.return_value = 100
     setgroups(list(range(400)))
     hack.assert_called_with(list(range(100)))