コード例 #1
0
    def test_askpass(self, mock_getpass: Mock):
        def getpass(prompt, stream):
            stream.write(prompt)
            return "hello"

        output = StringIO()
        console = ConsoleOutput(output)
        mock_getpass.side_effect = getpass
        self.assertEqual("hello", console.askpass("test: "))
        self.assertEqual("test: ", output.getvalue())
コード例 #2
0
ファイル: test_console.py プロジェクト: yuviDX/streamlink
 def test_askpass(self, isatty, getpass):
     isatty.return_value = True
     getpass.return_value = "hello"
     self.assertEqual("hello", ConsoleOutput.askpass("test: "))
コード例 #3
0
ファイル: test_console.py プロジェクト: yuviDX/streamlink
 def test_askpass_no_tty(self, isatty):
     isatty.return_value = False
     self.assertEqual("", ConsoleOutput.askpass("test: "))
コード例 #4
0
 def test_askpass_no_tty(self):
     output = StringIO()
     console = ConsoleOutput(output)
     self.assertIsNone(console.askpass("test: "))