def test_enforce_root_helper_with_no_root_helper_but_root(self):
     base = ip_lib.SubProcessBase()
     with mock.patch.object(os, "geteuid", return_value=0):
         try:
             base.enforce_root_helper()
         except exceptions.SudoRequired:
             self.fail("enforce_root_helper should not require a root " "helper when run as root.")
Exemple #2
0
 def test_enforce_root_helper_with_root_helper_supplied(self):
     base = ip_lib.SubProcessBase('sudo')
     try:
         base.enforce_root_helper()
     except exceptions.SudoRequired:
         self.fail('enforce_root_helper should not raise SudoRequired '
                   'when a root_helper is supplied.')
 def test_enforce_root_helper_with_root_helper_supplied(self):
     base = ip_lib.SubProcessBase('sudo')
     try:
         base.enforce_root_helper()
     except exceptions.SudoRequired:
         self.fail('enforce_root_helper should not raise SudoRequired '
                   'when a root_helper is supplied.')
Exemple #4
0
 def test_enforce_root_helper_with_no_root_helper_but_root(self):
     base = ip_lib.SubProcessBase()
     with mock.patch.object(os, 'geteuid', return_value=0):
         try:
             base.enforce_root_helper()
         except exceptions.SudoRequired:
             self.fail('enforce_root_helper should not require a root '
                       'helper when run as root.')