예제 #1
0
 def test_user_input_console(self):
     p = _TestPlugin("http://example.com/stream")
     with self._mock_console_input() as console_input:
         p.bind(self.session, 'test_plugin', console_input)
         self.assertEqual("username", p.input_ask("username"))
         self.assertEqual("password", p.input_ask_password("password"))
         console_input.console.ask.assert_called_with("username: "******"password: ")
예제 #2
0
 def test_user_input_console(self):
     p = _TestPlugin("http://example.com/stream")
     with self._mock_console_input() as console_input:
         p.bind(self.session, 'test_plugin', console_input)
         self.assertEqual("username", p.input_ask("username"))
         self.assertEqual("password", p.input_ask_password("password"))
         console_input.console.ask.assert_called_with("username: "******"password: ")
예제 #3
0
 def test_user_input_console_no_tty(self):
     p = _TestPlugin("http://example.com/stream")
     with self._mock_console_input(isatty=False) as console_input:
         p.bind(self.session, 'test_plugin', console_input)
         self.assertRaises(PluginError, p.input_ask, "username")
         self.assertRaises(PluginError, p.input_ask_password, "password")
예제 #4
0
 def test_user_input_not_implemented(self):
     p = _TestPlugin("http://example.com/stream")
     p.bind(self.session, 'test_plugin', UserInputRequester())
     self.assertRaises(PluginError, p.input_ask, 'test')
     self.assertRaises(PluginError, p.input_ask_password, 'test')
예제 #5
0
 def test_user_input_bad_class(self):
     p = _TestPlugin("http://example.com/stream")
     self.assertRaises(RuntimeError, p.bind, self.session, 'test_plugin',
                       object())
예제 #6
0
 def test_user_input_console_no_tty(self):
     p = _TestPlugin("http://example.com/stream")
     with self._mock_console_input(isatty=False) as console_input:
         p.bind(self.session, 'test_plugin', console_input)
         self.assertRaises(PluginError, p.input_ask, "username")
         self.assertRaises(PluginError, p.input_ask_password, "password")
예제 #7
0
 def test_user_input_not_implemented(self):
     p = _TestPlugin("http://example.com/stream")
     p.bind(self.session, 'test_plugin', UserInputRequester())
     self.assertRaises(PluginError, p.input_ask, 'test')
     self.assertRaises(PluginError, p.input_ask_password, 'test')
예제 #8
0
 def test_user_input_bad_class(self):
     p = _TestPlugin("http://example.com/stream")
     self.assertRaises(RuntimeError, p.bind, self.session, 'test_plugin', object())