Esempio n. 1
0
    def test_snapshot(self):
        '''
        Test parallels.snapshot
        '''
        name = 'macvm'

        # Validate creating a snapshot
        mock_snap = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap):
            parallels.snapshot(name)
            mock_snap.assert_called_once_with('snapshot', [name], runas=None)

        # Validate creating a snapshot with a name
        snap_name = 'h_0'
        mock_snap_name = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap_name):
            parallels.snapshot(name, snap_name)
            mock_snap_name.assert_called_once_with('snapshot',
                                                   [name, '--name', snap_name],
                                                   runas=None)

        # Validate creating a snapshot with a name and a description
        snap_name = 'h_0'
        snap_desc = textwrap.dedent('The ground state particle of the higgs '
                                    'multiplet family of bosons')
        mock_snap_name = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap_name):
            parallels.snapshot(name, snap_name, snap_desc)
            mock_snap_name.assert_called_once_with(
                'snapshot',
                [name, '--name', snap_name, '--description', snap_desc],
                runas=None)
Esempio n. 2
0
    def test_snapshot(self):
        """
        Test parallels.snapshot
        """
        name = "macvm"

        # Validate creating a snapshot
        mock_snap = MagicMock(return_value="")
        with patch.object(parallels, "prlctl", mock_snap):
            parallels.snapshot(name)
            mock_snap.assert_called_once_with("snapshot", [name], runas=None)

        # Validate creating a snapshot with a name
        snap_name = "h_0"
        mock_snap_name = MagicMock(return_value="")
        with patch.object(parallels, "prlctl", mock_snap_name):
            parallels.snapshot(name, snap_name)
            mock_snap_name.assert_called_once_with(
                "snapshot", [name, "--name", snap_name], runas=None
            )

        # Validate creating a snapshot with a name and a description
        snap_name = "h_0"
        snap_desc = textwrap.dedent(
            "The ground state particle of the higgs " "multiplet family of bosons"
        )
        mock_snap_name = MagicMock(return_value="")
        with patch.object(parallels, "prlctl", mock_snap_name):
            parallels.snapshot(name, snap_name, snap_desc)
            mock_snap_name.assert_called_once_with(
                "snapshot",
                [name, "--name", snap_name, "--description", snap_desc],
                runas=None,
            )
Esempio n. 3
0
    def test_snapshot(self):
        '''
        Test parallels.snapshot
        '''
        name = 'macvm'

        # Validate creating a snapshot
        mock_snap = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap):
            parallels.snapshot(name)
            mock_snap.assert_called_once_with('snapshot', [name], runas=None)

        # Validate creating a snapshot with a name
        snap_name = 'h_0'
        mock_snap_name = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap_name):
            parallels.snapshot(name, snap_name)
            mock_snap_name.assert_called_once_with('snapshot',
                                                   [name, '--name', snap_name],
                                                   runas=None)

        # Validate creating a snapshot with a name and a description
        snap_name = 'h_0'
        snap_desc = textwrap.dedent('The ground state particle of the higgs '
            'multiplet family of bosons')
        mock_snap_name = MagicMock(return_value='')
        with patch.object(parallels, 'prlctl', mock_snap_name):
            parallels.snapshot(name, snap_name, snap_desc)
            mock_snap_name.assert_called_once_with('snapshot',
                                                   [name,
                                                    '--name', snap_name,
                                                    '--description', snap_desc],
                                                   runas=None)