Example #1
0
    def test_snippet_delete_args_no_confirm(self, shell):
        """
        Test delete snippet with args (snippet name), unconfirmed.
        """
        shell.client.kickstart.snippet.delete = MagicMock()
        shell.help_snippet_delete = MagicMock()
        shell.user_confirm = MagicMock(return_value=False)

        out = snippet.do_snippet_delete(shell, "some-snippet")

        assert not shell.client.kickstart.snippet.delete.called
        assert not shell.help_snippet_delete.called
        assert out is None
Example #2
0
    def test_snippet_delete_no_args(self, shell):
        """
        Test delete snippet with no args
        """
        shell.client.kickstart.snippet.delete = MagicMock()
        shell.help_snippet_delete = MagicMock()
        shell.user_confirm = MagicMock(return_value=True)

        out = snippet.do_snippet_delete(shell, "")

        assert not shell.client.kickstart.snippet.delete.called
        assert shell.help_snippet_delete.called
        assert out is None
Example #3
0
    def test_snippet_delete_args(self, shell):
        """
        Test delete snippet with args (snippet name)
        """
        shell.client.kickstart.snippet.delete = MagicMock()
        shell.help_snippet_delete = MagicMock()
        shell.user_confirm = MagicMock(return_value=True)

        out = snippet.do_snippet_delete(shell, "some-snippet")

        assert shell.client.kickstart.snippet.delete.called
        assert not shell.help_snippet_delete.called
        assert out is None
        assert shell.client.kickstart.snippet.delete.call_args_list[0][0][0] == shell.session
        assert shell.client.kickstart.snippet.delete.call_args_list[0][0][1] == "some-snippet"