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
d178ebe9
Commit
d178ebe9
authored
Jan 31, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: lint test
parent
e7c72fb0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
30 deletions
+60
-30
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+60
-30
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
d178ebe9
...
...
@@ -42,7 +42,8 @@ class TestSlapOSPerson_checkToCreateRegularisationRequest(SlapOSTestCaseMixinWit
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredSlaposWebSiteUrl
(
'http://foobar.org/'
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
before_date
=
DateTime
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
after_date
=
DateTime
()
...
...
@@ -94,7 +95,8 @@ The slapos team
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredSlaposWebSiteUrl
(
'http://foobar.org/'
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
...
...
@@ -147,7 +149,8 @@ The slapos team
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_do_not_duplicate_ticket_if_not_reindexed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
transaction
.
commit
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
...
...
@@ -161,14 +164,16 @@ The slapos team
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_addRegularisationRequest_balance_ok
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertEqual
(
ticket
,
None
)
self
.
assertEqual
(
event
,
None
)
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_suspended_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
transaction
.
commit
()
self
.
tic
()
...
...
@@ -180,7 +185,8 @@ The slapos team
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_validated_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
.
validate
()
transaction
.
commit
()
...
...
@@ -193,7 +199,8 @@ The slapos team
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_existing_invalidated_ticket
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
person
.
Person_checkToCreateRegularisationRequest
()[
0
]
ticket
.
invalidate
()
transaction
.
commit
()
...
...
@@ -203,7 +210,8 @@ The slapos team
self
.
assertNotEqual
(
event2
,
None
)
def
test_addRegularisationRequest_REQUEST_disallowed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
self
.
assertRaises
(
Unauthorized
,
person
.
Person_checkToCreateRegularisationRequest
,
...
...
@@ -230,7 +238,8 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_matching_case
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source_project_value
=
person
)
ticket
.
validate
()
...
...
@@ -240,7 +249,8 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "0"'
)
def
test_invalidateIfPersonBalanceIsOk_validated
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source_project_value
=
person
)
ticket
.
validate
()
...
...
@@ -257,7 +267,8 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
@
simulate
(
'Entity_statOutstandingAmount'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_invalidateIfPersonBalanceIsOk_wrong_balance
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source_project_value
=
person
)
ticket
.
validate
()
...
...
@@ -277,7 +288,8 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
)
def
test_checkToSendUniqEvent_no_event
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
...
...
@@ -313,7 +325,8 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
)
def
test_checkToSendUniqEvent_call_twice_with_tic
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
...
...
@@ -332,7 +345,8 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
def
test_checkToSendUniqEvent_manual_event
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
...
...
@@ -357,7 +371,8 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
def
test_checkToSendUniqEvent_not_suspended
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
...
...
@@ -370,7 +385,8 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
,
None
)
def
test_checkToSendUniqEvent_event_not_reindexed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
...
...
@@ -927,7 +943,8 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_stopInstanceTreeList_matching_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
...
...
@@ -959,7 +976,8 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_stopInstanceTreeList_matching_subscription_2
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
...
...
@@ -988,7 +1006,8 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_other_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
@@ -1031,7 +1050,8 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_not_suspended
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
@@ -1053,7 +1073,8 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_other_resource
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
@@ -1095,7 +1116,8 @@ class TestSlapOSInstanceTree_stopFromRegularisationRequest(
REQUEST
=
{})
def
test_stopFromRegularisationRequest_matching_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
instance_tree
=
self
.
createInstanceTree
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
...
...
@@ -1123,7 +1145,8 @@ class TestSlapOSInstanceTree_stopFromRegularisationRequest(
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
"stop_requested"
)
def
test_stopFromRegularisationRequest_stopped_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
instance_tree
=
self
.
createInstanceTree
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
...
...
@@ -1166,7 +1189,8 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
REQUEST
=
{})
def
test_deleteFromRegularisationRequest_started_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
instance_tree
=
self
.
createInstanceTree
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
...
...
@@ -1194,7 +1218,8 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
"destroy_requested"
)
def
test_deleteFromRegularisationRequest_stopped_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
instance_tree
=
self
.
createInstanceTree
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
...
...
@@ -1224,7 +1249,8 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
"destroy_requested"
)
def
test_deleteFromRegularisationRequest_destroyed_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
instance_tree
=
self
.
createInstanceTree
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
...
...
@@ -1283,7 +1309,8 @@ class TestSlapOSRegularisationRequest_deleteInstanceTreeList(
'comment="Visited by InstanceTree_deleteFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_deleteInstanceTreeList_matching_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
...
...
@@ -1312,7 +1339,8 @@ class TestSlapOSRegularisationRequest_deleteInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_other_subscription
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
@@ -1355,7 +1383,8 @@ class TestSlapOSRegularisationRequest_deleteInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_not_suspended
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
@@ -1377,7 +1406,8 @@ class TestSlapOSRegularisationRequest_deleteInstanceTreeList(
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_other_resource
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
...
...
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