Skip to content

Commit

Permalink
Eliminate test warnings due to invalid uuids
Browse files Browse the repository at this point in the history
Tests results would include warnings along the lines of:

> FutureWarning: b"'test-node'" is an invalid UUID. Using UUIDFields with
> invalid UUIDs is no longer supported, and will be removed in a future
> release. Please update your code to input valid UUIDs or accept ValueErrors
> for invalid UUIDs.

This commit ensures that tests are using valid UUIDs.
  • Loading branch information
larsks committed Jan 24, 2025
1 parent 64b9b20 commit fe10fb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions esi_leap/tests/api/controllers/v1/test_console_auth_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import http.client as http_client
import mock
import uuid
from oslo_utils import uuidutils

from esi_leap.common import ironic
Expand All @@ -28,6 +29,7 @@ def setUp(self):
)
@mock.patch.object(ironic, "get_ironic_client", autospec=True)
def test_post(self, mock_client, mock_authorize):
mock_client.return_value.node.get.return_value = mock.Mock(uuid=uuid.uuid4())
mock_authorize.return_value = "fake-token"

data = {"node_uuid_or_name": self.node_uuid}
Expand Down
7 changes: 4 additions & 3 deletions esi_leap/tests/objects/test_console_auth_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from datetime import datetime
import mock
import uuid

from oslo_db.exception import DBDuplicateEntry
from oslo_utils import uuidutils
Expand All @@ -31,7 +32,7 @@ def setUp(self):

self.test_cat_dict = {
"id": 1,
"node_uuid": "test-node",
"node_uuid": str(uuid.uuid4()),
"token": self.token,
"expires": 1,
"created_at": self.created_at,
Expand All @@ -40,15 +41,15 @@ def setUp(self):

self.test_authorized_cat_dict = {
"id": 1,
"node_uuid": "test-node",
"node_uuid": str(uuid.uuid4()),
"token_hash": self.token_hash,
"expires": 1,
"created_at": self.created_at,
"updated_at": None,
}

self.test_unauthorized_cat_dict = {
"node_uuid": "test-node",
"node_uuid": str(uuid.uuid4()),
"token": self.token,
"expires": 1,
"created_at": self.created_at,
Expand Down

0 comments on commit fe10fb4

Please sign in to comment.