From a667e4d43aa25c5040ef2f4529080a83e30b167f Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Tue, 2 Jul 2024 20:46:31 +0100 Subject: [PATCH] test: guarantee randomness with uuid4 over randint --- src/backend/tests/test_projects_routes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/tests/test_projects_routes.py b/src/backend/tests/test_projects_routes.py index 4e839fa1b..8358e7c64 100644 --- a/src/backend/tests/test_projects_routes.py +++ b/src/backend/tests/test_projects_routes.py @@ -21,8 +21,8 @@ import os from io import BytesIO from pathlib import Path -from random import randint from unittest.mock import Mock, patch +from uuid import uuid4 import pytest import requests @@ -52,7 +52,7 @@ async def test_create_project(client, admin_user, organisation): project_data = { "project_info": { - "name": f"Test Project {randint(1, 1000000)}", + "name": f"Test Project {uuid4()}", "short_description": "test", "description": "test", }, @@ -87,7 +87,6 @@ async def test_create_project(client, admin_user, organisation): async def test_delete_project(client, admin_user, project): """Test deleting a FMTM project, plus ODK Central project.""" - log.warning(project) response = client.delete(f"/projects/{project.id}") assert response.status_code == 204 @@ -279,7 +278,7 @@ async def test_update_project(client, admin_user, project): """Test update project metadata.""" updated_project_data = { "project_info": { - "name": f"Updated Test Project {randint(1, 1000000)}", + "name": f"Updated Test Project {uuid4()}", "short_description": "updated short description", "description": "updated description", },