]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
fix broken test for the new module magic 22/head
authorAlfredo Deza <alfredo@deza.pe>
Thu, 25 Jul 2013 16:37:43 +0000 (12:37 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Thu, 25 Jul 2013 16:37:43 +0000 (12:37 -0400)
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
ceph_deploy/tests/test_cli_install.py

index 0e8dcb0e7003181055b35fe1d811027da1286490..d0a1cd3fcaedfd3df35cdb0c3e347b1e5d4926f7 100644 (file)
@@ -41,23 +41,26 @@ def test_simple(tmpdir):
 
     mock_compiled = collections.defaultdict(mock.Mock)
     conn.compile.return_value = mock.Mock(return_value = ('Ubuntu', 'precise','cuttlefish'))
-
+    fake_get_release = mock.Mock(return_value = ('Ubuntu', 'precise','cuttlefish'))
+    fake_distro = mock.Mock(name='FakeDistro')
+    fake_distro.return_value = fake_distro
 
     try:
         with directory(str(tmpdir)):
-            main(
-                args=['-v', 'install', 'storehost1'],
-                namespace=ns,
-                )
+            with mock.patch('ceph_deploy.hosts.lsb.get_lsb_release', fake_get_release):
+                with mock.patch('ceph_deploy.hosts.pushy', ns.pushy):
+                    with mock.patch('ceph_deploy.hosts._get_distro', fake_distro):
+
+                        main(
+                            args=['-v', 'install', 'storehost1'],
+                            namespace=ns,
+                            )
     except SystemExit as e:
         raise AssertionError('Unexpected exit: %s', e)
 
-    ns.pushy.assert_has_calls([
-            mock.call('ssh+sudo:storehost1'),
-        ])
-
-    call_list = conn.compile.call_args_list
-    mock.call(install.lsb.check_lsb_release) == call_list[0]
-    mock.call(install.lsb.lsb_release) == call_list[1]
-    mock.call(install.install_debian) == call_list[2]
-    assert len(call_list) == 3
+    connect_calls = ns.pushy.connect.call_args[0][0]
+    assert connect_calls == 'ssh+sudo:storehost1'
+    assert fake_distro.name == 'Ubuntu'
+    assert fake_distro.release == 'precise'
+    assert fake_distro.codename == 'cuttlefish'
+    assert fake_distro.sudo_conn.compile.call_count == 1