Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
676faad9
Commit
676faad9
authored
Jan 30, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: fix Computer Network creation test
parent
f6d1cc42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
...s/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
+25
-12
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
View file @
676faad9
...
@@ -827,6 +827,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -827,6 +827,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
self
.
project
=
self
.
addProject
()
person_user
=
self
.
makePerson
(
self
.
project
)
person_user
=
self
.
makePerson
(
self
.
project
)
# Only admin can create computer network
self
.
addProjectProductionManagerAssignment
(
person_user
,
self
.
project
)
self
.
tic
()
self
.
tic
()
# Login as new user
# Login as new user
...
@@ -837,14 +839,21 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -837,14 +839,21 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
pass
pass
def
test_Person_requestNetwork_title_is_mandato
t
y
(
self
):
def
test_Person_requestNetwork_title_is_mandato
r
y
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
assertRaises
(
TypeError
,
person
.
requestNetwork
)
self
.
assertRaises
(
TypeError
,
person
.
requestNetwork
,
project_reference
=
self
.
project
.
getReference
())
def
test_Person_requestNetwork_project_is_mandatory
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
assertRaises
(
TypeError
,
person
.
requestNetwork
,
network_title
=
self
.
generateNewNetworkTitle
())
def
test_Person_requestNetwork
(
self
):
def
test_Person_requestNetwork
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
network_title
=
self
.
generateNewNetworkTitle
()
network_title
=
self
.
generateNewNetworkTitle
()
person
.
requestNetwork
(
network_title
=
network_title
)
person
.
requestNetwork
(
network_title
=
network_title
,
project_reference
=
self
.
project
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
login
()
self
.
login
()
...
@@ -852,10 +861,10 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -852,10 +861,10 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
self
.
assertNotEqual
(
None
,
network_relative_url
)
self
.
assertNotEqual
(
None
,
network_relative_url
)
network
=
person
.
restrictedTraverse
(
network_relative_url
)
network
=
person
.
restrictedTraverse
(
network_relative_url
)
self
.
assertEqual
(
network
.
get
SourceAdministration
(),
self
.
assertEqual
(
network
.
get
FollowUp
(),
person
.
getRelativeUrl
())
self
.
project
.
getRelativeUrl
())
self
.
assertEqual
(
network
.
getTitle
(),
network_title
)
self
.
assertEqual
(
network
.
getTitle
(),
network_title
)
self
.
assertEqual
(
network
.
getValidationState
(),
"validated"
)
self
.
assertEqual
(
network
.
getValidationState
(),
"validated"
)
self
.
assertIn
(
"NET-"
,
network
.
getReference
())
self
.
assertIn
(
"NET-"
,
network
.
getReference
())
...
@@ -864,7 +873,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -864,7 +873,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
def
test_Person_requestNetwork_duplicated
(
self
):
def
test_Person_requestNetwork_duplicated
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
network_title
=
self
.
generateNewNetworkTitle
()
network_title
=
self
.
generateNewNetworkTitle
()
person
.
requestNetwork
(
network_title
=
network_title
)
person
.
requestNetwork
(
network_title
=
network_title
,
project_reference
=
self
.
project
.
getReference
())
self
.
tic
()
self
.
tic
()
self
.
login
()
self
.
login
()
...
@@ -874,8 +884,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -874,8 +884,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
None
,
network_relative_url
)
self
.
assertNotEqual
(
None
,
network_relative_url
)
network
=
person
.
restrictedTraverse
(
network_relative_url
)
network
=
person
.
restrictedTraverse
(
network_relative_url
)
self
.
assertEqual
(
network
.
get
SourceAdministration
(),
self
.
assertEqual
(
network
.
get
FollowUp
(),
person
.
getRelativeUrl
())
self
.
project
.
getRelativeUrl
())
self
.
assertEqual
(
network
.
getTitle
(),
network_title
)
self
.
assertEqual
(
network
.
getTitle
(),
network_title
)
self
.
assertEqual
(
network
.
getValidationState
(),
"validated"
)
self
.
assertEqual
(
network
.
getValidationState
(),
"validated"
)
self
.
assertIn
(
"NET-"
,
network
.
getReference
())
self
.
assertIn
(
"NET-"
,
network
.
getReference
())
...
@@ -886,12 +896,14 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -886,12 +896,14 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
self
.
assertRaises
(
NotImplementedError
,
person
.
requestNetwork
,
self
.
assertRaises
(
NotImplementedError
,
person
.
requestNetwork
,
network_title
=
network_title
)
network_title
=
network_title
,
project_reference
=
self
.
project
.
getReference
())
def
test_Person_requestNetwork_request_again
(
self
):
def
test_Person_requestNetwork_request_again
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
network_title
=
self
.
generateNewNetworkTitle
()
network_title
=
self
.
generateNewNetworkTitle
()
person
.
requestNetwork
(
network_title
=
network_title
)
person
.
requestNetwork
(
network_title
=
network_title
,
project_reference
=
self
.
project
.
getReference
())
# check what is returned via request
# check what is returned via request
network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
...
@@ -904,7 +916,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
...
@@ -904,7 +916,8 @@ class TestSlapOSCorePersonRequestNetwork(SlapOSTestCaseMixin):
person
.
REQUEST
.
set
(
'computer_network_relative_url'
,
None
)
person
.
REQUEST
.
set
(
'computer_network_relative_url'
,
None
)
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
person
.
requestNetwork
(
network_title
=
network_title
)
person
.
requestNetwork
(
network_title
=
network_title
,
project_reference
=
self
.
project
.
getReference
())
# check what is returned via request
# check what is returned via request
same_network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
same_network_relative_url
=
person
.
REQUEST
.
get
(
'computer_network_relative_url'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment