Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
75ac15a7
Commit
75ac15a7
authored
1 year ago
by
Hakan Calim
Committed by
Karel van Klink
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-410: added a test for validate tt number
parent
a6c90397
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!159
Feature/nat 410 add validator for tty number
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/utils/test_helpers.py
+23
-1
23 additions, 1 deletion
test/utils/test_helpers.py
with
23 additions
and
1 deletion
test/utils/test_helpers.py
+
23
−
1
View file @
75ac15a7
...
...
@@ -4,7 +4,7 @@ import pytest
from
gso.products.product_blocks.iptrunk
import
IptrunkInterfaceBlock
from
gso.products.product_blocks.router
import
RouterVendor
from
gso.utils.helpers
import
available_interfaces_choices_including_current_members
from
gso.utils.helpers
import
available_interfaces_choices_including_current_members
,
validate_tt_number
@pytest.fixture
()
...
...
@@ -62,3 +62,25 @@ def test_nokia_router_with_interfaces_returns_choice(mock_router, mock_netbox_cl
assert
hasattr
(
result
,
"
interface1
"
)
assert
hasattr
(
result
,
"
interface2
"
)
assert
hasattr
(
result
,
"
interface3
"
)
def
test_tt_number
(
faker
):
"""
Test different TT numbers
"""
# Define different tt number
tt_number_valid1
=
faker
.
tt_number
()
tt_number_valid2
=
faker
.
tt_number
()
tt_number_valid3
=
faker
.
tt_number
()
tt_number_not_valid1
=
faker
.
sentence
()
err_msg
=
(
f
"
The given TT number:
{
tt_number_not_valid1
}
is not valid.
"
f
"
A valid TT number starts with
'
TT#
'
followed by 16 digits.
"
)
assert
validate_tt_number
(
tt_number_valid1
)
==
tt_number_valid1
assert
validate_tt_number
(
tt_number_valid2
)
==
tt_number_valid2
assert
validate_tt_number
(
tt_number_valid3
)
==
tt_number_valid3
with
pytest
.
raises
(
ValueError
,
match
=
err_msg
):
validate_tt_number
(
tt_number_not_valid1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment