From a319e4c82d85206851de66d6b661d93a90f924d2 Mon Sep 17 00:00:00 2001 From: Dmitry Borodaenko Date: Tue, 10 Sep 2013 14:40:09 -0700 Subject: [PATCH] split unit test into two, fix typo in comments Signed-off-by: Dmitry Borodaenko --- ceph_deploy/misc.py | 2 +- ceph_deploy/tests/unit/test_mon.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ceph_deploy/misc.py b/ceph_deploy/misc.py index 08d7ce3..b4b8318 100644 --- a/ceph_deploy/misc.py +++ b/ceph_deploy/misc.py @@ -26,7 +26,7 @@ def mon_hosts(mons): def remote_shortname(socket): """ Obtains remote hostname of the socket and cuts off the domain part - if it's FQDN. + of its FQDN. """ return socket.gethostname().split('.', 1)[0] diff --git a/ceph_deploy/tests/unit/test_mon.py b/ceph_deploy/tests/unit/test_mon.py index 7f0c601..7ffb5ba 100644 --- a/ceph_deploy/tests/unit/test_mon.py +++ b/ceph_deploy/tests/unit/test_mon.py @@ -131,11 +131,12 @@ class TestCreateMon(object): result = hosts.mock_calls assert result == expected - def test_remote_shortname(self): + def test_remote_shortname_fqdn(self): socket = Mock() socket.gethostname.return_value = 'host.f.q.d.n' assert remote_shortname(socket) == 'host' + def test_remote_shortname_host(self): socket = Mock() socket.gethostname.return_value = 'host' assert remote_shortname(socket) == 'host' -- 2.47.3