]> git-server-git.apps.pok.os.sepia.ceph.com Git - remoto.git/commitdiff
add tests for the needs_ssh fix
authorAlfredo Deza <alfredo@deza.pe>
Fri, 5 Sep 2014 15:47:50 +0000 (11:47 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Fri, 5 Sep 2014 15:47:50 +0000 (11:47 -0400)
remoto/tests/test_connection.py

index dc5aeeb458e1824632839393d94a9d5390588744..324da7c912fb79c93267760812970e3c9c1235ea 100644 (file)
@@ -4,8 +4,9 @@ from remoto import connection
 
 class FakeSocket(object):
 
-    def __init__(self, gethostname):
+    def __init__(self, gethostname, getfqdn=None):
         self.gethostname = lambda: gethostname
+        self.getfqdn = lambda: getfqdn or gethostname
 
 
 class TestNeedsSsh(object):
@@ -22,6 +23,11 @@ class TestNeedsSsh(object):
         socket = FakeSocket('foo')
         assert connection.needs_ssh('meh', socket) is True
 
+    def test_fqdn_hostname_matches_short_hostname(self):
+        socket = FakeSocket('foo', getfqdn='foo.example.org')
+        assert connection.needs_ssh('foo.example.org', socket) is False
+
+
 
 class FakeGateway(object):