Exemplo n.º 1
0
 def _set_distro(self):
     """Determine distro for image and create instance of class."""
     if self.distro_name == 'sles':
         self.distro = SLES()
     elif self.distro_name == 'opensuse_leap':
         self.distro = openSUSE_Leap()
     else:
         raise IpaCloudException('Distribution: %s, not supported.' %
                                 self.distro_name)
def test_opensuse_leap_set_init_system():
    """Test openSUSE_Leap and SLES set init system method."""
    client = MagicMock()
    leap = openSUSE_Leap()

    with patch('img_proof.ipa_utils.execute_ssh_command',
               MagicMock(return_value='systemd')) as mocked:
        leap._set_init_system(client)

    assert leap.init_system == 'systemd'
    mocked.assert_called_once_with(client, 'ps -p 1 -o comm=')