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
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
3cc7f371
Commit
3cc7f371
authored
Oct 31, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: Test Base_hasSlapOSProjectUserGroup
parent
60ea2776
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
2 deletions
+138
-2
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
...Item/portal_components/test.erp5.testSlapOSCodingStyle.py
+0
-1
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_hasSlapOSProjectUserGroup.py
...rtal_skins/slapos_panel/Base_hasSlapOSProjectUserGroup.py
+1
-1
master/bt5/slapos_panel/TestTemplateItem/portal_components/test.erp5.testSlapOSPanelSkins.py
...eItem/portal_components/test.erp5.testSlapOSPanelSkins.py
+137
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
View file @
3cc7f371
...
...
@@ -213,7 +213,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_panel/Base_getNewsDictFromComputeNodeList'
,
'slapos_panel/Base_getPaymentModeForCurrency'
,
'slapos_panel/Base_getStatusMonitorUrl'
,
'slapos_panel/Base_hasSlapOSProjectUserGroup'
,
'slapos_panel/CertificateLogin_invalidateOnSlaposPanel'
,
'slapos_panel/ComputeNode_getBusyComputePartitionList'
,
'slapos_panel/ComputeNode_requestCertificate'
,
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_hasSlapOSProjectUserGroup.py
View file @
3cc7f371
...
...
@@ -12,7 +12,7 @@ elif project_relation == 'source_project':
else
:
raise
ValueError
(
'Unexpected project relation: %s'
%
project_relation
)
if
project
is
None
:
if
project
is
None
or
project
.
getPortalType
()
!=
'Project'
:
return
False
project_codification
=
project
.
getCodification
()
...
...
master/bt5/slapos_panel/TestTemplateItem/portal_components/test.erp5.testSlapOSPanelSkins.py
View file @
3cc7f371
...
...
@@ -59,6 +59,143 @@ class TestSupportRequestModule_getRssFeedUrl(TestPanelSkinsMixin):
self
.
tic
()
self
.
assertEqual
(
url
,
module
.
SupportRequestModule_getRssFeedUrl
())
class
TestBase_hasSlapOSProjectUserGroup
(
TestPanelSkinsMixin
):
def
test_Base_hasSlapOSProjectUserGroup_invalid_context
(
self
):
self
.
assertRaises
(
ValueError
,
self
.
project
.
Base_hasSlapOSProjectUserGroup
,
project_relation
=
'couscous'
)
def
test_Base_hasSlapOSProjectUserGroup_customer
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
())
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
agent
=
True
))
self
.
assertTrue
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
customer
=
True
))
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_project_manager
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionManagerAssignment
(
person
,
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
())
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
agent
=
True
))
self
.
assertTrue
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
customer
=
True
))
self
.
assertTrue
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_agent
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionAgentAssignment
(
person
,
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
())
self
.
assertTrue
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
agent
=
True
))
self
.
assertTrue
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
customer
=
True
))
self
.
assertFalse
(
self
.
project
.
Base_hasSlapOSProjectUserGroup
(
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_destination_project
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionManagerAssignment
(
person
,
self
.
project
)
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
'TESTSUPPORTREQUEST-%s'
%
self
.
generateNewId
(),
destination_project_value
=
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
# Uses project_relation='context'
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
agent
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
customer
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
manager
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
agent
=
True
))
self
.
assertTrue
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
customer
=
True
))
self
.
assertTrue
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_source_project
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionManagerAssignment
(
person
,
self
.
project
)
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
'TESTSUPPORTREQUEST-%s'
%
self
.
generateNewId
(),
source_project_value
=
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
# Uses project_relation='context'
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
agent
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
customer
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'destination_project'
,
manager
=
True
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
))
self
.
assertFalse
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
agent
=
True
))
self
.
assertTrue
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
customer
=
True
))
self
.
assertTrue
(
support_request
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'source_project'
,
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_follow_up
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionManagerAssignment
(
person
,
self
.
project
)
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
title
=
'TESTCOMPUTERNODE-%s'
%
self
.
generateNewId
(),
follow_up_value
=
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertFalse
(
compute_node
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'follow_up'
))
self
.
assertFalse
(
compute_node
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'follow_up'
,
agent
=
True
))
self
.
assertTrue
(
compute_node
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'follow_up'
,
customer
=
True
))
self
.
assertTrue
(
compute_node
.
Base_hasSlapOSProjectUserGroup
(
project_relation
=
'follow_up'
,
manager
=
True
))
def
test_Base_hasSlapOSProjectUserGroup_not_a_project
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionAgentAssignment
(
person
,
self
.
project
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
# Uses project_relation='context'
self
.
assertFalse
(
person
.
Base_hasSlapOSProjectUserGroup
())
self
.
assertFalse
(
person
.
Base_hasSlapOSProjectUserGroup
(
agent
=
True
))
self
.
assertFalse
(
person
.
Base_hasSlapOSProjectUserGroup
(
customer
=
True
))
self
.
assertFalse
(
person
.
Base_hasSlapOSProjectUserGroup
(
manager
=
True
))
class
TestPerson_getCertificate
(
TestPanelSkinsMixin
):
...
...
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