diff --git a/tests/requests/test_servers.py b/tests/requests/test_servers.py index 360a5bb..8bf3d95 100644 --- a/tests/requests/test_servers.py +++ b/tests/requests/test_servers.py @@ -8,6 +8,7 @@ from vshieldpy.api_defs.plans import Plans from vshieldpy.api_defs.tasks import ServerActions from vshieldpy.exceptions.parameter_exceptions import ( + InvalidDays, InvalidHostname, ReinstallWithoutOS, ) @@ -54,6 +55,7 @@ async def test_server_manage_autorenew(): async def test_server_update_hostname(): new_hostname = await client.set_server_hostname(0, "SteinsGate") assert isinstance(new_hostname, str) + with pytest.raises(InvalidHostname): await client.set_server_hostname(0, str(list(range(0, 20)))) @@ -72,6 +74,9 @@ async def test_server_renew(): payment = await client.renew_server(0, 100) assert type(payment) == Payment + with pytest.raises(InvalidDays): + await client.renew_server(0, 366) + async def test_server_delete(): task_id = await client.delete_server(0) @@ -83,3 +88,12 @@ async def test_server_order(): Plans.VDS_PRO_GOLD, Locations.US, "Hello", OperatingSystems.Ubuntu20, 10 ) assert type(payment) == Payment + + with pytest.raises(InvalidDays): + await client.order_server( + Plans.VDS_PRO_GOLD, + Locations.US, + "darkness", + OperatingSystems.WindowsServer22, + 0, + ) diff --git a/tests/requests/test_services.py b/tests/requests/test_services.py index d408478..a7dd160 100644 --- a/tests/requests/test_services.py +++ b/tests/requests/test_services.py @@ -3,7 +3,7 @@ from vshieldpy.api_defs.auto_renew import AutoRenew from vshieldpy.api_defs.operating_systems import OperatingSystems from vshieldpy.api_defs.tasks import ServiceActions -from vshieldpy.exceptions.parameter_exceptions import ReinstallWithoutOS +from vshieldpy.exceptions.parameter_exceptions import InvalidMonths, ReinstallWithoutOS from vshieldpy.products.service import Hosting from . import client @@ -42,3 +42,7 @@ async def test_service_manage_auto_renew(): async def test_service_renew(): payment = await client.renew_service(1, 3) assert payment.invoice_id is None + + with pytest.raises(InvalidMonths): + # Ignoring the type just for testing purposes. + await client.renew_service(1, 0) # type: ignore