コード例 #1
0
 def test_unix_set_prompt_exception3(self):
     uobject = MagicMock(spec=UnixHost)
     uobject.execute = MagicMock()
     uobject.execute.side_effect = (1, -1)
     type(uobject).response = PropertyMock(side_effect=['csh $'])
     self.assertRaises(Exception,
                       lambda: UnixHost.set_prompt(uobject, prompt='TOBY'))
コード例 #2
0
 def test_unix_set_prompt_expection2(self):
     uobject = MagicMock(spec=UnixHost)
     uobject.execute = MagicMock(return_value=1)
     uobject.prompt = MagicMock(return_value="TOBY")
     type(uobject).response = PropertyMock(side_effect=['vsh $'])
     self.assertRaises(Exception,
                       lambda: UnixHost.set_prompt(uobject, prompt='TOBY'))
コード例 #3
0
 def test_unix_set_prompt_exception2(self):
     uobject = MagicMock(spec=UnixHost)
     uobject.execute = MagicMock(return_value=-1)
     self.assertRaises(Exception,
                       lambda: UnixHost.set_prompt(uobject, prompt='TOBY'))
コード例 #4
0
 def test_unix_set_prompt_csh(self):
     uobject = MagicMock(spec=UnixHost)
     uobject.execute = MagicMock(return_value=1)
     uobject.prompt = MagicMock(return_value="TOBY")
     type(uobject).response = PropertyMock(side_effect=['csh $'])
     self.assertTrue(UnixHost.set_prompt(uobject, prompt='TOBY'))