[Git][NTPsec/ntpsec][master] Fix for packet tests so they can run wiithout a tty

Ian Bruene gitlab at mg.gitlab.com
Wed Sep 27 12:37:42 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
1bf2dd5f by Ian Bruene at 2017-09-27T07:36:24-05:00
Fix for packet tests so they can run wiithout a tty

- - - - -


1 changed file:

- tests/pylib/test_packet.py


Changes:

=====================================
tests/pylib/test_packet.py
=====================================
--- a/tests/pylib/test_packet.py
+++ b/tests/pylib/test_packet.py
@@ -925,6 +925,7 @@ class TestControlSession(unittest.TestCase):
     def test_password(self):
         iojig = jigs.FileJig()
         fakegetpmod = jigs.GetpassModuleJig()
+        fakeosmod = jigs.OSModuleJig()
         # Init
         cls = self.target()
         try:
@@ -935,8 +936,11 @@ class TestControlSession(unittest.TestCase):
             sys.stdin = iojig
             tempstdout = sys.stdout
             sys.stdout = iojig
+            tempos = ntpp.os
+            ntpp.os = fakeosmod
             # Test with nothing
             iojig.readline_return = ["1\n"] * 10
+            fakeosmod.isatty_returns = [True] * 10
             cls.password()
             self.assertEqual(isinstance(cls.auth, AuthenticatorJig), True)
             self.assertEqual(cls.keyid, 1)
@@ -972,6 +976,7 @@ class TestControlSession(unittest.TestCase):
             ntpp.getpass = getpass
             sys.stdin = tempstdin
             sys.stdout = tempstdout
+            ntpp.os = tempos
 
     def test_sendpkt(self):
         logjig = jigs.FileJig()



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1bf2dd5ffb4f872a63c5b148e5a106b2f8208caf

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1bf2dd5ffb4f872a63c5b148e5a106b2f8208caf
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170927/e949666a/attachment.html>


More information about the vc mailing list