Skip to content

Commit

Permalink
Add unit tests for coriolisclient.v1.licensing_server.py module
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi1324 committed Nov 26, 2024
1 parent 1844992 commit b14cf98
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions coriolisclient/tests/v1/test_licensing_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Cloudbase Solutions Srl
# All Rights Reserved.

from unittest import mock

from coriolisclient.tests import test_base
from coriolisclient.v1 import licensing
from coriolisclient.v1 import licensing_server


class LicensingServerManagerTestCase(
test_base.CoriolisBaseTestCase):
"""Test suite for the Coriolis v1 Licensing Server Manager."""

@mock.patch.object(licensing, 'LicensingClient')
def setUp(self, mock_LicensingClient):
mock_client = mock.Mock()
self.mock_licencing_client = mock.Mock()
mock_LicensingClient.return_value = self.mock_licencing_client
super(LicensingServerManagerTestCase, self).setUp()
self.licence = licensing_server.LicensingServerManager(
mock_client)

def test_status(self):
mock_resource_class = mock.Mock()
self.licence.resource_class = mock_resource_class

result = self.licence.status()

self.assertEqual(
mock_resource_class.return_value,
result
)
self.mock_licencing_client.get.assert_called_once_with(
'/status',
response_key='status')
mock_resource_class.assert_called_once_with(
self.licence, self.mock_licencing_client.get.return_value,
loaded=True)

0 comments on commit b14cf98

Please sign in to comment.