Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /khulnasoft_DockNet /backend /tests /test_id_utils.py
| import pytest | |
| from docknet.utils import id_utils | |
| def test_generate_readable_id( | |
| input_str: str, max_length: int, min_length: int, expected_id: str | |
| ) -> None: | |
| # TODO: add more tests | |
| result = id_utils.generate_readable_id( | |
| input_str, max_length=max_length, min_length=min_length | |
| ) | |
| assert result == expected_id | |
| def test_generate_short_uuid() -> None: | |
| # Short UUID should have a length of 25 | |
| assert len(id_utils.generate_short_uuid()) == 25 | |
| # All uuids should be different | |
| assert id_utils.generate_short_uuid() != id_utils.generate_short_uuid() | |
| def test_generate_token() -> None: | |
| # Should return a token with the given length | |
| for token_length in range(1, 40): | |
| assert len(id_utils.generate_token(token_length)) == token_length | |
| # All tokens should be different | |
| assert id_utils.generate_token(40) != id_utils.generate_token(40) | |
| def test_get_project_resource_prefix() -> None: | |
| from docknet.config import settings | |
| assert ( | |
| id_utils.get_project_resource_prefix("my-project") | |
| == settings.SYSTEM_NAMESPACE + "-p-my-project" | |
| ) | |
Xet Storage Details
- Size:
- 1.3 kB
- Xet hash:
- 69c2b3aa3dd177cd6706aab9388bf4f3537067b1d4c57c81aa139d4e0831c8d5
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.