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
586f1a25
Commit
586f1a25
authored
10 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Add imported site unit tests
parent
b7a8332f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!213
Add unit tests for imported products
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/workflows/site/test_create_imported_site.py
+32
-0
32 additions, 0 deletions
test/workflows/site/test_create_imported_site.py
test/workflows/site/test_import_site.py
+18
-0
18 additions, 0 deletions
test/workflows/site/test_import_site.py
with
50 additions
and
0 deletions
test/workflows/site/test_create_imported_site.py
0 → 100644
+
32
−
0
View file @
586f1a25
import
pytest
from
orchestrator.types
import
SubscriptionLifecycle
from
products.product_blocks.site
import
SiteTier
from
gso.products.product_types.site
import
ImportedSite
from
test.workflows
import
assert_complete
,
extract_state
,
run_workflow
@pytest.mark.workflow
()
def
test_create_imported_site_success
(
faker
):
initial_created_site_data
=
[
{
"
site_name
"
:
faker
.
site_name
(),
"
site_city
"
:
faker
.
city
(),
"
site_country
"
:
faker
.
country
(),
"
site_country_code
"
:
faker
.
country_code
(),
"
site_latitude
"
:
"
-74.0060
"
,
"
site_longitude
"
:
"
40.7128
"
,
"
site_bgp_community_id
"
:
faker
.
pyint
(),
"
site_internal_id
"
:
faker
.
pyint
(),
"
site_tier
"
:
SiteTier
.
TIER1
,
"
site_ts_address
"
:
faker
.
ipv4
(),
"
partner
"
:
"
GEANT
"
,
}
]
result
,
_
,
_
=
run_workflow
(
"
create_imported_site
"
,
initial_created_site_data
)
assert_complete
(
result
)
state
=
extract_state
(
result
)
subscription_id
=
state
[
"
subscription_id
"
]
subscription
=
ImportedSite
.
from_subscription
(
subscription_id
)
assert
subscription
.
status
==
SubscriptionLifecycle
.
ACTIVE
This diff is collapsed.
Click to expand it.
test/workflows/site/test_import_site.py
0 → 100644
+
18
−
0
View file @
586f1a25
import
pytest
from
orchestrator.types
import
SubscriptionLifecycle
from
gso.products
import
ProductName
from
gso.products.product_types.site
import
Site
from
test.workflows
import
assert_complete
,
run_workflow
@pytest.mark.workflow
()
def
test_import_site_success
(
site_subscription_factory
):
imported_site
=
site_subscription_factory
(
is_imported
=
False
)
result
,
_
,
_
=
run_workflow
(
"
import_site
"
,
[{
"
subscription_id
"
:
imported_site
}])
subscription
=
Site
.
from_subscription
(
imported_site
)
assert_complete
(
result
)
assert
subscription
.
product
.
name
==
ProductName
.
SITE
assert
subscription
.
status
==
SubscriptionLifecycle
.
ACTIVE
assert
subscription
.
insync
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