def test_try_getpass_eof(self): getpass = self.patch(auth, "getpass") getpass.side_effect = EOFError self.assertIsNone(auth.try_getpass(sentinel.prompt)) getpass.assert_called_once_with(sentinel.prompt)
def test_try_getpass(self): getpass = self.patch(auth, "getpass") getpass.return_value = sentinel.credentials self.assertIs(sentinel.credentials, auth.try_getpass(sentinel.prompt)) getpass.assert_called_once_with(sentinel.prompt)
def test_try_getpass_eof(self): getpass = self.patch(auth, "getpass") getpass.side_effect = EOFError self.assertIsNone(auth.try_getpass(sentinel.prompt)) self.assertThat(getpass, MockCalledOnceWith(sentinel.prompt))
def test_try_getpass(self): getpass = self.patch(auth, "getpass") getpass.return_value = sentinel.credentials self.assertIs(sentinel.credentials, auth.try_getpass(sentinel.prompt)) self.assertThat(getpass, MockCalledOnceWith(sentinel.prompt))