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
19
Merge Requests
19
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
22ce5324
Commit
22ce5324
authored
Feb 08, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup.
parent
24f4783d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
179 deletions
+10
-179
master/product/Vifib/tests/testVifibSlapComputerPartitionLock.py
...product/Vifib/tests/testVifibSlapComputerPartitionLock.py
+10
-179
No files found.
master/product/Vifib/tests/testVifibSlapComputerPartitionLock.py
View file @
22ce5324
from
Products.ERP5Type.tests.Sequence
import
SequenceList
import
unittest
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
from
random
import
random
from
slapos
import
slap
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.backportUnittest
import
skip
class
TestVifibSlapComputerPartitionLock
(
TestVifibSlapWebServiceMixin
):
...
...
@@ -19,36 +14,17 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
Tic
\
AcceptSubmittedCredentialsActiveSense
\
Tic
\
Logout
\
'
Logout'
create_new_user_instance_sequence_string
=
'
\
LoginWebUser
\
PersonRequestSoftwareInstance
\
Tic
\
Logout
\
\
LoginDefaultUser
\
ConfirmOrderedSaleOrderActiveSense
\
lock_user_sequence_string
=
'
\
LoginERP5TypeTestCase
\
TriggerBuild
\
Tic
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
'
create_new_user_slave_instance_sequence_string
=
'
\
LoginWebUser
\
PersonRequestSlaveInstance
\
TriggerStopConfirmedInvoiceAlarm
\
Tic
\
Logout
\
\
LoginDefaultUser
\
ConfirmOrderedSaleOrderActiveSense
\
TriggerBuild
\
Tic
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
'
Logout'
def
stepSoftwareInstanceSaleOrderConfirmRaisesUnauthorized
(
self
,
sequence
,
**
kw
):
...
...
@@ -88,8 +64,8 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
sequence_list
=
SequenceList
()
sequence_string
=
\
self
.
prepare_installed_software_release_sequence_string
+
\
self
.
register_new_user_sequence_string
\
+
self
.
lock_user_string
()
+
'
\
self
.
register_new_user_sequence_string
+
\
self
.
lock_user_sequence_string
+
'
\
LoginWebUser
\
PersonRequestSoftwareInstance
\
Tic
\
...
...
@@ -116,7 +92,7 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
sequence_string
=
\
self
.
prepare_install_requested_computer_partition_sequence_string
+
\
self
.
register_new_user_sequence_string
+
\
self
.
lock_user_s
tring
()
+
'
\
self
.
lock_user_s
equence_string
+
'
\
LoginWebUser
\
PersonRequestSlaveInstance
\
Tic
\
...
...
@@ -136,151 +112,6 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
stepCreateSmallInvoiceWebUser
(
self
,
sequence
,
**
kw
):
person
=
self
.
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
sequence
[
'web_user'
])
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
start_date
=
DateTime
(),
resource
=
'currency_module/EUR'
,
source_section
=
'organisation_module/vifib_internet'
,
source
=
'organisation_module/vifib_internet'
,
destination_section
=
person
.
getRelativeUrl
(),
destination
=
person
.
getRelativeUrl
(),
specialise
=
'sale_trade_condition_module/vifib_trade_condition'
)
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
resource
=
self
.
portal
.
portal_preferences
.
getPreferredRegistrationResource
(),
quantity
=
1
,
price
=
1
)
sequence
[
'invoice'
]
=
invoice
def
stepPlanInvoice
(
self
,
sequence
,
**
kw
):
sequence
[
'invoice'
].
plan
()
def
stepConfirmInvoice
(
self
,
sequence
,
**
kw
):
sequence
[
'invoice'
].
confirm
()
def
stepStartInvoice
(
self
,
sequence
,
**
kw
):
sequence
[
'invoice'
].
start
()
def
stepCheckWebUserBalanceHighAmount
(
self
,
sequence
,
**
kw
):
person
=
self
.
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
sequence
[
'web_user'
])
self
.
assertEqual
(
-
10000.0
,
self
.
portal
.
portal_simulation
.
getInventoryAssetPrice
(
node_category
=
'account_type/asset/receivable'
,
simulation_state
=
[
'started'
,
'stopped'
,
'delivered'
],
section_uid
=
self
.
portal
.
restrictedTraverse
(
'organisation_module/vifib_internet'
).
getUid
(),
mirror_section_uid
=
person
.
getUid
())
)
def
stepCheckWebUserBalanceSmallAmount
(
self
,
sequence
,
**
kw
):
person
=
self
.
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
sequence
[
'web_user'
])
self
.
assertEqual
(
-
1.0
,
self
.
portal
.
portal_simulation
.
getInventoryAssetPrice
(
node_category
=
'account_type/asset/receivable'
,
simulation_state
=
[
'started'
,
'stopped'
,
'delivered'
],
section_uid
=
self
.
portal
.
restrictedTraverse
(
'organisation_module/vifib_internet'
).
getUid
(),
mirror_section_uid
=
person
.
getUid
())
)
def
stepCreatePastSmallPayment
(
self
,
sequence
,
**
kw
):
person
=
self
.
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
sequence
[
'web_user'
])
payment_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
destination_section
=
'organisation_module/vifib_internet'
,
source_section
=
person
.
getRelativeUrl
(),
resource
=
'currency_module/EUR'
,
portal_type
=
"Payment Transaction"
,
start_date
=
DateTime
()
-
90
,
)
payment_transaction
.
newContent
(
portal_type
=
"Accounting Transaction Line"
,
quantity
=
1
,
destination
=
'account_module/receivable'
,
)
payment_transaction
.
newContent
(
portal_type
=
"Accounting Transaction Line"
,
quantity
=-
1
,
destination
=
'account_module/sales'
,
)
payment_transaction
.
confirm
()
payment_transaction
.
checkConsistency
()
sequence
[
'payment_transaction'
]
=
payment_transaction
def
stepCancelPayment
(
self
,
sequence
,
**
kw
):
sequence
[
'payment_transaction'
].
cancel
()
def
stepStartPayment
(
self
,
sequence
,
**
kw
):
sequence
[
'payment_transaction'
].
start
()
def
stepStopPayment
(
self
,
sequence
,
**
kw
):
sequence
[
'payment_transaction'
].
stop
()
def
stepDeliverPayment
(
self
,
sequence
,
**
kw
):
sequence
[
'payment_transaction'
].
deliver
()
def
stepCreateHighBalanceInvoiceWebUser
(
self
,
sequence
,
**
kw
):
person
=
self
.
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
(
sequence
[
'web_user'
])
invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
start_date
=
DateTime
(),
resource
=
'currency_module/EUR'
,
source_section
=
'organisation_module/vifib_internet'
,
source
=
'organisation_module/vifib_internet'
,
destination_section
=
person
.
getRelativeUrl
(),
destination
=
person
.
getRelativeUrl
(),
specialise
=
'sale_trade_condition_module/vifib_trade_condition'
)
invoice
.
newContent
(
portal_type
=
'Invoice Line'
,
resource
=
self
.
portal
.
portal_preferences
.
getPreferredRegistrationResource
(),
quantity
=
1
,
price
=
10000
)
sequence
[
'invoice'
]
=
invoice
def
new_software_instance_string
(
self
):
return
\
self
.
prepare_installed_software_release_sequence_string
+
\
self
.
register_new_user_sequence_string
+
'
\
LoginERP5TypeTestCase
\
TriggerUnlockPersonAlarm
\
Tic
\
Logout
\
'
+
\
self
.
create_new_user_instance_sequence_string
def
new_slave_instance_string
(
self
):
return
\
self
.
prepare_installed_computer_partition_sequence_string
+
\
self
.
register_new_user_sequence_string
+
'
\
LoginERP5TypeTestCase
\
TriggerUnlockPersonAlarm
\
Tic
\
Logout
\
'
+
\
self
.
create_new_user_slave_instance_sequence_string
def
lock_user_string
(
self
):
return
'
\
LoginERP5TypeTestCase
\
TriggerBuild
\
Tic
\
TriggerStopConfirmedInvoiceAlarm
\
Tic
\
TriggerBuild
\
Tic
\
Logout'
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestVifibSlapComputerPartitionLock
))
...
...
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