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
e6609b6f
Commit
e6609b6f
authored
Aug 25, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Add tests for constraints
parent
ce1a954c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+88
-0
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
e6609b6f
...
@@ -1505,6 +1505,94 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
...
@@ -1505,6 +1505,94 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
None
,
None
,
instance_tree
.
InstanceTree_checkSoftwareInstanceState
())
instance_tree
.
InstanceTree_checkSoftwareInstanceState
())
class
TestCRMPropertySheetConstraint
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
portal
=
self
.
getPortalObject
()
self
.
ticket_trade_condition
=
portal
.
sale_trade_condition_module
.
slapos_ticket_trade_condition
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
.
support_request
=
portal
.
support_request_module
.
newContent
(
portal_type
=
"Support Request"
,
destination_decision
=
person_user
.
getRelativeUrl
(),
specialise
=
self
.
ticket_trade_condition
.
getRelativeUrl
()
)
# Value set by the init
self
.
assertTrue
(
self
.
support_request
.
getReference
().
startswith
(
"SR-"
),
"Reference don't start with SR- : %s"
%
self
.
support_request
.
getReference
())
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
testCheckCausalitySourceDestinationConsistency
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
support_request
.
approveRegistration
()
self
.
tic
()
self
.
logout
()
self
.
login
()
event
=
self
.
support_request
.
getCausalityValue
()
self
.
assertNotEqual
(
event
,
None
)
self
.
assertFalse
(
event
.
checkConsistency
())
self
.
assertFalse
(
self
.
support_request
.
checkConsistency
())
source
=
event
.
getDestination
()
event
.
setDestination
(
person
.
getRelativeUrl
())
non_consistency_list
=
[
str
(
i
.
getTranslatedMessage
())
for
i
in
self
.
support_request
.
checkConsistency
()]
self
.
assertEqual
(
non_consistency_list
,
[
'Destination of the related event should be the slapos organisation'
])
event
.
setSource
(
source
)
non_consistency_list
=
[
str
(
i
.
getTranslatedMessage
())
for
i
in
self
.
support_request
.
checkConsistency
()]
self
.
assertEqual
(
non_consistency_list
,
[
'Sender of the related event should be the customer'
,
'Destination of the related event should be the slapos organisation'
])
def
testCheckCustomerAsSourceOrDestinationConsistency
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
self
.
support_request
.
approveRegistration
()
self
.
tic
()
self
.
logout
()
self
.
login
()
event
=
self
.
support_request
.
getCausalityValue
()
self
.
assertNotEqual
(
event
,
None
)
self
.
assertFalse
(
event
.
checkConsistency
())
self
.
assertFalse
(
self
.
support_request
.
checkConsistency
())
person_user
=
self
.
makePerson
()
self
.
tic
()
event
.
setSource
(
person_user
.
getRelativeUrl
())
non_consistency_list
=
[
str
(
i
.
getTranslatedMessage
())
for
i
in
event
.
checkConsistency
()]
self
.
assertEqual
(
non_consistency_list
,
[
'Customer should be source or destination of the event'
])
event
.
setDestination
(
person
.
getRelativeUrl
())
self
.
assertFalse
(
event
.
checkConsistency
())
class
TestSupportRequestUpdateMonitoringState
(
SlapOSTestCaseMixin
):
class
TestSupportRequestUpdateMonitoringState
(
SlapOSTestCaseMixin
):
def
_makeInstanceTree
(
self
):
def
_makeInstanceTree
(
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