File: test_trashcan.py

package info (click to toggle)
python-gvm 26.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,220 kB
  • sloc: python: 45,844; makefile: 18
file content (24 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# SPDX-FileCopyrightText: 2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later

import unittest

from gvm.errors import RequiredArgument
from gvm.protocols.gmp.requests.v224 import TrashCan


class TrashCanTestCase(unittest.TestCase):
    def test_empty_trashcan(self):
        request = TrashCan.empty_trashcan()

        self.assertEqual(bytes(request), b"<empty_trashcan/>")

    def test_restore_from_trashcan(self):
        request = TrashCan.restore_from_trashcan("1")

        self.assertEqual(bytes(request), b'<restore id="1"/>')

    def test_restore_from_trashcan_with_empty_id(self):
        with self.assertRaises(RequiredArgument):
            TrashCan.restore_from_trashcan("")