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
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
f71e0314
Commit
f71e0314
authored
Nov 01, 2024
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: Fixup and test Base_hasSlapOSAccountingUserGroup
parent
8fefe667
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_hasSlapOSAccountingUserGroup.py
...l_skins/slapos_panel/Base_hasSlapOSAccountingUserGroup.py
+1
-1
master/bt5/slapos_panel/TestTemplateItem/portal_components/test.erp5.testSlapOSPanelSkins.py
...eItem/portal_components/test.erp5.testSlapOSPanelSkins.py
+57
-0
No files found.
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Base_hasSlapOSAccountingUserGroup.py
View file @
f71e0314
...
...
@@ -19,7 +19,7 @@ user_group_list = getGroups()
return
(
((
customer
)
and
(
destination_decision
.
getPortalType
()
==
'Person'
)
and
(
destination_decision
.
getU
serId
()
in
user_group_list
)
(
destination_decision
.
getU
id
()
==
member
.
getUserValue
().
getUid
()
)
)
or
((
accountant
)
and
(
'F-ACCOUNTING*'
in
user_group_list
))
or
((
seller
)
and
(
'F-SALEMAN'
in
user_group_list
))
or
...
...
master/bt5/slapos_panel/TestTemplateItem/portal_components/test.erp5.testSlapOSPanelSkins.py
View file @
f71e0314
...
...
@@ -59,6 +59,63 @@ class TestSupportRequestModule_getRssFeedUrl(TestPanelSkinsMixin):
self
.
tic
()
self
.
assertEqual
(
url
,
module
.
SupportRequestModule_getRssFeedUrl
())
class
TestBase_hasSlapOSAccountingUserGroup
(
TestPanelSkinsMixin
):
def
test_Base_hasSlapOSAccountingUserGroup_invalid_context
(
self
):
self
.
assertRaises
(
ValueError
,
self
.
project
.
Base_hasSlapOSAccountingUserGroup
,
customer_relation
=
'context'
)
def
test_Base_hasSlapOSAccountingUserGroup
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addProjectProductionManagerAssignment
(
person
,
self
.
project
)
self
.
tic
()
subscription_request
=
self
.
portal
.
subscription_request_module
.
newContent
(
portal_type
=
'Subscription Request'
,
title
=
'TESTSUBREQ-%s'
%
self
.
generateNewId
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
project
)
subscription_request
.
submit
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
# Uses customer_relation='destination_decision'
self
.
assertFalse
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
())
self
.
assertFalse
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
seller
=
True
))
self
.
assertTrue
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
customer
=
True
))
self
.
assertFalse
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
accountant
=
True
))
def
test_Base_hasSlapOSAccountingUserGroup_sale_manager
(
self
):
# Assignment for customer is added automatically
person
=
self
.
makePerson
(
self
.
project
,
user
=
1
)
self
.
addSaleManagerAssignment
(
person
)
self
.
tic
()
subscription_request
=
self
.
portal
.
subscription_request_module
.
newContent
(
portal_type
=
'Subscription Request'
,
title
=
'TESTSUBREQ-%s'
%
self
.
generateNewId
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
project
)
subscription_request
.
submit
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
# Uses customer_relation='destination_decision'
self
.
assertFalse
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
())
self
.
assertTrue
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
seller
=
True
))
self
.
assertTrue
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
customer
=
True
))
self
.
assertFalse
(
subscription_request
.
Base_hasSlapOSAccountingUserGroup
(
accountant
=
True
))
class
TestBase_hasSlapOSProjectUserGroup
(
TestPanelSkinsMixin
):
def
test_Base_hasSlapOSProjectUserGroup_invalid_context
(
self
):
...
...
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