def test_update_repository(self, p_execute_command, p_get_os_distrib, p_get_os_version): # test ubuntu p_get_os_distrib.return_value = 'ubuntu' ssh_remote._update_repository() p_execute_command.assert_called_with('apt-get update', run_as_root=True) # test centos p_get_os_distrib.return_value = 'centos' ssh_remote._update_repository() p_execute_command.assert_called_with('yum clean all', run_as_root=True) # test fedora < 22 p_get_os_distrib.return_value = 'fedora' p_get_os_version.return_value = 20 ssh_remote._update_repository() p_execute_command.assert_called_with('yum clean all', run_as_root=True) # test fedora >=22 p_get_os_distrib.return_value = 'fedora' p_get_os_version.return_value = 23 ssh_remote._update_repository() p_execute_command.assert_called_with('dnf clean all', run_as_root=True) # test redhat p_get_os_distrib.return_value = 'redhat' ssh_remote._update_repository() p_execute_command.assert_called_with('yum clean all', run_as_root=True)
def test_update_repository(self, p_execute_command, p_get_os_distrib, p_get_os_version): # test ubuntu p_get_os_distrib.return_value = 'ubuntu' ssh_remote._update_repository() p_execute_command.assert_called_with( 'apt-get update', run_as_root=True) # test centos p_get_os_distrib.return_value = 'centos' ssh_remote._update_repository() p_execute_command.assert_called_with( 'yum clean all', run_as_root=True) # test fedora < 22 p_get_os_distrib.return_value = 'fedora' p_get_os_version.return_value = 20 ssh_remote._update_repository() p_execute_command.assert_called_with( 'yum clean all', run_as_root=True) # test fedora >=22 p_get_os_distrib.return_value = 'fedora' p_get_os_version.return_value = 23 ssh_remote._update_repository() p_execute_command.assert_called_with( 'dnf clean all', run_as_root=True) # test redhat p_get_os_distrib.return_value = 'redhat' ssh_remote._update_repository() p_execute_command.assert_called_with( 'yum clean all', run_as_root=True)
def test_update_repository_bad(self, p_get_os_distrib): with testtools.ExpectedException( ex.NotImplementedException, 'Repository Update is not implemented for OS windows me.*'): ssh_remote._update_repository()