Ejemplo n.º 1
0
	def testModeSudo( self ):
		assert not cuisine.mode(cuisine.MODE_SUDO)
		cuisine.mode_sudo()
		assert cuisine.mode(cuisine.MODE_SUDO)
		cuisine.mode_user()
		assert not cuisine.mode(cuisine.MODE_SUDO)
		# We use the mode changer to switch to sudo temporarily
		with cuisine.mode_sudo():
			assert cuisine.mode(cuisine.MODE_SUDO)
		assert cuisine.mode(cuisine.MODE_LOCAL)
		# We go into sudo from sudo
		with cuisine.mode_sudo():
			assert cuisine.mode(cuisine.MODE_SUDO)
Ejemplo n.º 2
0
 def testModeSudo(self):
     assert not cuisine.mode(cuisine.MODE_SUDO)
     cuisine.mode_sudo()
     assert cuisine.mode(cuisine.MODE_SUDO)
     cuisine.mode_user()
     assert not cuisine.mode(cuisine.MODE_SUDO)
     # We use the mode changer to switch to sudo temporarily
     with cuisine.mode_sudo():
         assert cuisine.mode(cuisine.MODE_SUDO)
     assert cuisine.mode(cuisine.MODE_LOCAL)
     # We go into sudo from sudo
     with cuisine.mode_sudo():
         assert cuisine.mode(cuisine.MODE_SUDO)
Ejemplo n.º 3
0
	def testModeLocal( self ):
		# We switch to remote and switch back to local
		assert cuisine.mode(cuisine.MODE_LOCAL)
		cuisine.mode_remote()
		assert not cuisine.mode(cuisine.MODE_LOCAL)
		cuisine.mode_local()
		assert cuisine.mode(cuisine.MODE_LOCAL)
		# We use the mode changer to switch to remote temporarily
		with cuisine.mode_remote():
			assert not cuisine.mode(cuisine.MODE_LOCAL)
		assert cuisine.mode(cuisine.MODE_LOCAL)
		# We go into local from local
		with cuisine.mode_local():
			assert cuisine.mode(cuisine.MODE_LOCAL)
Ejemplo n.º 4
0
 def testModeLocal(self):
     # We switch to remote and switch back to local
     assert cuisine.mode(cuisine.MODE_LOCAL)
     cuisine.mode_remote()
     assert not cuisine.mode(cuisine.MODE_LOCAL)
     cuisine.mode_local()
     assert cuisine.mode(cuisine.MODE_LOCAL)
     # We use the mode changer to switch to remote temporarily
     with cuisine.mode_remote():
         assert not cuisine.mode(cuisine.MODE_LOCAL)
     assert cuisine.mode(cuisine.MODE_LOCAL)
     # We go into local from local
     with cuisine.mode_local():
         assert cuisine.mode(cuisine.MODE_LOCAL)