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
0
Merge Requests
0
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
Léo-Paul Géneau
slapos.core
Commits
f16b042f
Commit
f16b042f
authored
Dec 24, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add test for project_slap_interface_workflow
parent
9ed1636d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
353 additions
and
0 deletions
+353
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.py
.../test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.py
+219
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.xml
...test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.xml
+133
-0
master/bt5/slapos_cloud/bt/template_test_id_list
master/bt5/slapos_cloud/bt/template_test_id_list
+1
-0
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.py
0 → 100644
View file @
f16b042f
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
zExceptions
import
Unauthorized
import
transaction
class
TestSlapOSCoreProjectSlapInterfaceWorkflow
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
portal
=
self
.
getPortalObject
()
person_user
=
self
.
makePerson
()
self
.
tic
()
# Login as new user
self
.
login
(
person_user
.
getUserId
())
new_person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
assertEqual
(
person_user
.
getRelativeUrl
(),
new_person
.
getRelativeUrl
())
self
.
project
=
portal
.
project_module
.
newContent
(
portal_type
=
"Project"
)
# Value set by the init
self
.
assertTrue
(
self
.
project
.
getReference
().
startswith
(
"PROJ-"
),
"Reference don't start with PROJ- : %s"
%
self
.
project
.
getReference
())
self
.
tic
()
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
test_project_approveRegistration_no_reference
(
self
):
self
.
project
.
setReference
(
None
)
self
.
assertRaises
(
ValueError
,
self
.
project
.
approveRegistration
)
def
test_project_approveRegistration_already_validated
(
self
):
# Login as admin since user cannot re-approve a validated project
self
.
login
()
self
.
project
.
setReference
(
None
)
self
.
project
.
validate
()
# Don't raise if project is validated
self
.
assertEqual
(
self
.
project
.
approveRegistration
(),
None
)
def
test_project_approveRegistration
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
project
.
approveRegistration
()
self
.
tic
()
self
.
logout
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
self
.
project
.
getValidationState
(),
'validated'
)
self
.
assertNotEqual
(
self
.
project
.
getStartDate
(),
None
)
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'open'
)
self
.
assertIn
(
"Assigment for Project "
,
assignment_list
[
0
].
getTitle
())
def
test_project_leaveProject_no_user
(
self
):
self
.
login
()
self
.
assertRaises
(
Unauthorized
,
self
.
project
.
leaveProject
)
def
test_project_leaveProject_owner
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
project
.
edit
(
destination_decision
=
person
.
getRelativeUrl
())
self
.
tic
()
self
.
project
.
leaveProject
()
self
.
assertEqual
(
self
.
project
.
getDestinationDecision
(),
None
)
def
test_project_leaveProject_after_join
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
# Just make things fast, by using the API tested above
self
.
project
.
approveRegistration
()
self
.
tic
()
self
.
logout
()
self
.
login
(
person
.
getUserId
())
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'open'
)
self
.
project
.
leaveProject
()
self
.
tic
()
self
.
login
()
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'closed'
)
def
test_project_acceptInvitation_no_invitation_token
(
self
):
self
.
assertRaises
(
TypeError
,
self
.
project
.
acceptInvitation
)
def
test_project_acceptInvitation_no_token_dont_exist
(
self
):
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
"DONOTEXIST"
)
def
test_project_acceptInvitation
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
login
()
token
=
self
.
portal
.
invitation_token_module
.
newContent
(
portal_type
=
"Invitation Token"
)
token_id
=
token
.
getId
()
# User is None
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
# Not validated yet
self
.
login
(
person
.
getUserId
())
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
self
.
login
()
token
.
validate
()
token
.
setSourceValue
(
person
)
self
.
login
(
person
.
getUserId
())
# Not used by the owner
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
self
.
login
()
token
.
setSourceValue
(
None
)
self
.
login
(
person
.
getUserId
())
self
.
project
.
acceptInvitation
(
invitation_token
=
token_id
)
self
.
tic
()
self
.
login
()
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'open'
)
self
.
assertEqual
(
token
.
getValidationState
(),
"invalidated"
)
def
test_project_acceptInvitation_already_member
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
project
.
approveRegistration
()
self
.
tic
()
self
.
login
()
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'open'
)
token
=
self
.
portal
.
invitation_token_module
.
newContent
(
portal_type
=
"Invitation Token"
)
token_id
=
token
.
getId
()
# User is None
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
# Not validated yet
self
.
login
(
person
.
getUserId
())
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
self
.
login
()
token
.
validate
()
token
.
setSourceValue
(
person
)
self
.
login
(
person
.
getUserId
())
# Not used by the owner
self
.
assertRaises
(
ValueError
,
self
.
project
.
acceptInvitation
,
invitation_token
=
token_id
)
self
.
login
()
token
.
setSourceValue
(
None
)
self
.
login
(
person
.
getUserId
())
self
.
project
.
acceptInvitation
(
invitation_token
=
token_id
)
self
.
tic
()
self
.
login
()
assignment_list
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Assignment"
)
if
i
.
getDestinationProjectValue
()
==
self
.
project
]
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
assignment_list
[
0
].
getValidationState
(),
'open'
)
self
.
assertEqual
(
token
.
getValidationState
(),
"invalidated"
)
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow.xml
0 → 100644
View file @
f16b042f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCloudProjectSlapInterfaceWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/bt/template_test_id_list
View file @
f16b042f
...
@@ -5,6 +5,7 @@ test.erp5.testSlapOSCloudInteractionWorkflow
...
@@ -5,6 +5,7 @@ test.erp5.testSlapOSCloudInteractionWorkflow
test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow
test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow
test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow
test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow
test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow
test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow
test.erp5.testSlapOSCloudProjectSlapInterfaceWorkflow
test.erp5.testSlapOSCloudSecurityGroup
test.erp5.testSlapOSCloudSecurityGroup
test.erp5.testSlapOSCloudConstraint
test.erp5.testSlapOSCloudConstraint
test.erp5.testSlapOSCloudUpgrader
test.erp5.testSlapOSCloudUpgrader
...
...
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