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
Carlos Ramos Carreño
slapos.core
Commits
645e1dc2
Commit
645e1dc2
authored
Aug 26, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: Remove unused ERP5Security Login
The code was merged into ERP5 Security, so this code is obsolte
parent
a927cc96
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
716 deletions
+0
-716
master/product/Vifib/VifibCookieHashExtractionPlugin.py
master/product/Vifib/VifibCookieHashExtractionPlugin.py
+0
-187
master/product/Vifib/__init__.py
master/product/Vifib/__init__.py
+0
-35
master/product/Vifib/tests/testVifibUsageReport.py
master/product/Vifib/tests/testVifibUsageReport.py
+0
-386
master/product/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt
...uct/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt
+0
-36
master/product/Vifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt
...ifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt
+0
-36
master/product/Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt
.../Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt
+0
-36
master/product/Vifib/www/portal.gif
master/product/Vifib/www/portal.gif
+0
-0
No files found.
master/product/Vifib/VifibCookieHashExtractionPlugin.py
deleted
100644 → 0
View file @
a927cc96
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
Products.ERP5Type.Globals
import
InitializeClass
from
AccessControl
import
ClassSecurityInfo
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
Products.PluggableAuthService.interfaces
import
plugins
from
Products.PluggableAuthService.utils
import
classImplements
from
Products.PluggableAuthService.plugins.BasePlugin
import
BasePlugin
from
Products.PluggableAuthService.PluggableAuthService
import
DumbHTTPExtractor
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
class
VifibCookieHashExtractionPlugin
(
BasePlugin
):
"""
Plugin to authenicate as machines.
"""
security
=
ClassSecurityInfo
()
def
__init__
(
self
,
id
,
title
=
None
):
#Register value
self
.
_setId
(
id
)
self
.
title
=
title
#####################
# memcached helpers #
#####################
def
_getCacheFactory
(
self
):
portal
=
self
.
getPortalObject
()
cache_tool
=
portal
.
portal_caches
cache_factory
=
cache_tool
.
getRamCacheRoot
().
get
(
self
.
cache_factory_name
)
#XXX This conditional statement should be remove as soon as
#Broadcasting will be enable among all zeo clients.
#Interaction which update portal_caches should interact with all nodes.
if
cache_factory
is
None
\
and
getattr
(
cache_tool
,
self
.
cache_factory_name
,
None
)
is
not
None
:
#ram_cache_root is not up to date for current node
cache_tool
.
updateCache
()
cache_factory
=
cache_tool
.
getRamCacheRoot
().
get
(
self
.
cache_factory_name
)
if
cache_factory
is
None
:
raise
KeyError
return
cache_factory
def
getKey
(
self
,
key
):
cache_factory
=
self
.
_getCacheFactory
()
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
cache_entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
if
cache_entry
is
not
None
:
return
cache_entry
.
getValue
()
raise
KeyError
(
'Key %r not found'
%
key
)
####################################
#ILoginPasswordHostExtractionPlugin#
####################################
security
.
declarePrivate
(
'extractCredentials'
)
def
extractCredentials
(
self
,
request
):
""" Extract CookieHash credentials from the request header. """
creds
=
{}
cookie_hash
=
request
.
get
(
self
.
cookie_name
)
if
cookie_hash
is
not
None
:
try
:
user_dict
=
self
.
getKey
(
cookie_hash
)
except
KeyError
:
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
if
'login'
in
user_dict
:
creds
[
'external_login'
]
=
user_dict
[
'login'
]
creds
[
'remote_host'
]
=
request
.
get
(
'REMOTE_HOST'
,
''
)
try
:
creds
[
'remote_address'
]
=
request
.
getClientAddr
()
except
AttributeError
:
creds
[
'remote_address'
]
=
request
.
get
(
'REMOTE_ADDR'
,
''
)
return
creds
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
#Form for new plugin in ZMI
manage_addVifibFacebookServerExtractionPluginForm
=
PageTemplateFile
(
'www/Vifib_addVifibFacebookServerExtractionPlugin'
,
globals
(),
__name__
=
'manage_addVifibFacebookServerExtractionPluginForm'
)
def
addVifibFacebookServerExtractionPlugin
(
dispatcher
,
id
,
title
=
None
,
REQUEST
=
None
):
""" Add a VifibFacebookServerExtractionPlugin to a Pluggable Auth Service. """
plugin
=
VifibFacebookServerExtractionPlugin
(
id
,
title
)
dispatcher
.
_setObject
(
plugin
.
getId
(),
plugin
)
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
redirect
(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibFacebookServerExtractionPlugin+added.'
%
dispatcher
.
absolute_url
())
class
VifibFacebookServerExtractionPlugin
(
VifibCookieHashExtractionPlugin
):
cache_factory_name
=
'facebook_server_auth_token_cache_factory'
cookie_name
=
'__ac_facebook_hash'
meta_type
=
"Vifib Facebook Server Extraction Plugin"
#List implementation of class
classImplements
(
VifibFacebookServerExtractionPlugin
,
plugins
.
ILoginPasswordHostExtractionPlugin
)
InitializeClass
(
VifibFacebookServerExtractionPlugin
)
#Form for new plugin in ZMI
manage_addVifibGoogleServerExtractionPluginForm
=
PageTemplateFile
(
'www/Vifib_addVifibGoogleServerExtractionPlugin'
,
globals
(),
__name__
=
'manage_addVifibGoogleServerExtractionPluginForm'
)
def
addVifibGoogleServerExtractionPlugin
(
dispatcher
,
id
,
title
=
None
,
REQUEST
=
None
):
""" Add a VifibGoogleServerExtractionPlugin to a Pluggable Auth Service. """
plugin
=
VifibGoogleServerExtractionPlugin
(
id
,
title
)
dispatcher
.
_setObject
(
plugin
.
getId
(),
plugin
)
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
redirect
(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibGoogleServerExtractionPlugin+added.'
%
dispatcher
.
absolute_url
())
class
VifibGoogleServerExtractionPlugin
(
VifibCookieHashExtractionPlugin
):
cache_factory_name
=
'google_server_auth_token_cache_factory'
cookie_name
=
'__ac_google_hash'
meta_type
=
"Vifib Google Server Extraction Plugin"
#List implementation of class
classImplements
(
VifibGoogleServerExtractionPlugin
,
plugins
.
ILoginPasswordHostExtractionPlugin
)
InitializeClass
(
VifibGoogleServerExtractionPlugin
)
#Form for new plugin in ZMI
manage_addVifibBrowserIDExtractionPluginForm
=
PageTemplateFile
(
'www/Vifib_addVifibBrowserIDExtractionPlugin'
,
globals
(),
__name__
=
'manage_addVifibBrowserIDExtractionPluginForm'
)
def
addVifibBrowserIDExtractionPlugin
(
dispatcher
,
id
,
title
=
None
,
REQUEST
=
None
):
""" Add a VifibBrowserIDExtractionPlugin to a Pluggable Auth Service. """
plugin
=
VifibBrowserIDExtractionPlugin
(
id
,
title
)
dispatcher
.
_setObject
(
plugin
.
getId
(),
plugin
)
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
redirect
(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibBrowserIDExtractionPlugin+added.'
%
dispatcher
.
absolute_url
())
class
VifibBrowserIDExtractionPlugin
(
VifibCookieHashExtractionPlugin
):
cache_factory_name
=
'browser_id_auth_token_cache_factory'
cookie_name
=
'__ac_browser_id_hash'
meta_type
=
"Vifib Browser ID Extraction Plugin"
#List implementation of class
classImplements
(
VifibBrowserIDExtractionPlugin
,
plugins
.
ILoginPasswordHostExtractionPlugin
)
InitializeClass
(
VifibBrowserIDExtractionPlugin
)
master/product/Vifib/__init__.py
View file @
645e1dc2
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#
#
##############################################################################
##############################################################################
from
Products.ERP5Type.Utils
import
initializeProduct
,
updateGlobals
from
Products.ERP5Type.Utils
import
initializeProduct
,
updateGlobals
from
AccessControl.Permissions
import
manage_users
as
ManageUsers
import
sys
import
sys
import
Permissions
import
Permissions
this_module
=
sys
.
modules
[
__name__
]
this_module
=
sys
.
modules
[
__name__
]
...
@@ -39,9 +38,7 @@ content_classes = ()
...
@@ -39,9 +38,7 @@ content_classes = ()
content_constructors
=
()
content_constructors
=
()
from
Tool
import
SlapTool
from
Tool
import
SlapTool
portal_tools
=
(
SlapTool
.
SlapTool
,
)
portal_tools
=
(
SlapTool
.
SlapTool
,
)
from
Products.PluggableAuthService.PluggableAuthService
import
registerMultiPlugin
import
VifibCookieHashExtractionPlugin
def
initialize
(
context
):
def
initialize
(
context
):
import
Document
import
Document
...
@@ -49,35 +46,3 @@ def initialize(context):
...
@@ -49,35 +46,3 @@ def initialize(context):
document_classes
=
document_classes
,
object_classes
=
object_classes
,
document_classes
=
document_classes
,
object_classes
=
object_classes
,
portal_tools
=
portal_tools
,
content_constructors
=
content_constructors
,
portal_tools
=
portal_tools
,
content_constructors
=
content_constructors
,
content_classes
=
content_classes
)
content_classes
=
content_classes
)
context
.
registerClass
(
VifibCookieHashExtractionPlugin
.
VifibFacebookServerExtractionPlugin
,
permission
=
ManageUsers
,
constructors
=
(
VifibCookieHashExtractionPlugin
.
manage_addVifibFacebookServerExtractionPluginForm
,
VifibCookieHashExtractionPlugin
.
addVifibFacebookServerExtractionPlugin
,
)
,
visibility
=
None
,
icon
=
'www/portal.gif'
)
context
.
registerClass
(
VifibCookieHashExtractionPlugin
.
VifibGoogleServerExtractionPlugin
,
permission
=
ManageUsers
,
constructors
=
(
VifibCookieHashExtractionPlugin
.
manage_addVifibGoogleServerExtractionPluginForm
,
VifibCookieHashExtractionPlugin
.
addVifibGoogleServerExtractionPlugin
,
)
,
visibility
=
None
,
icon
=
'www/portal.gif'
)
context
.
registerClass
(
VifibCookieHashExtractionPlugin
.
VifibBrowserIDExtractionPlugin
,
permission
=
ManageUsers
,
constructors
=
(
VifibCookieHashExtractionPlugin
.
manage_addVifibBrowserIDExtractionPluginForm
,
VifibCookieHashExtractionPlugin
.
addVifibBrowserIDExtractionPlugin
,
)
,
visibility
=
None
,
icon
=
'www/portal.gif'
)
registerMultiPlugin
(
VifibCookieHashExtractionPlugin
.
VifibFacebookServerExtractionPlugin
.
meta_type
)
registerMultiPlugin
(
VifibCookieHashExtractionPlugin
.
VifibGoogleServerExtractionPlugin
.
meta_type
)
registerMultiPlugin
(
VifibCookieHashExtractionPlugin
.
VifibBrowserIDExtractionPlugin
.
meta_type
)
master/product/Vifib/tests/testVifibUsageReport.py
deleted
100644 → 0
View file @
a927cc96
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Nicolas Godbert <ngodbert@tiolive.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#############################################################################
import
unittest
from
lxml
import
etree
from
slapos
import
slap
from
testVifibSlapWebService
import
TestVifibSlapWebServiceMixin
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.backportUnittest
import
skip
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestVifibUsageReport
))
return
suite
class
TestVifibUsageReportMixin
(
TestVifibSlapWebServiceMixin
):
prepare_confirmed_cleanup_resource_packing_list2
=
"""
\
LoginTestVifibAdmin
\
RequestSoftwareInstallation
\
Tic
\
Logout
\
\
SlapLoginCurrentComputer
\
ComputerSoftwareReleaseAvailable
\
Tic
\
SlapLogout
\
\
LoginTestVifibCustomer
\
PersonRequestSoftwareInstance
\
Tic
\
Logout
\
\
LoginDefaultUser
\
CallSlaposAllocateInstanceAlarm
\
Tic
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListDelivered
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceBuilding
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListDelivered
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceAvailable
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
SetSelectedComputerPartition
\
CheckComputerPartitionInstanceSetupSalePackingListDelivered
\
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
\
Logout
\
\
LoginDefaultUser
\
CreateSalePackingList
\
Tic
\
CreateSalePackingListLine
\
Tic
\
SetSalePackingListLineCleanupResource
\
SetSalePackingListLineAggregate
\
ConfirmSalePackingList
\
StartBuildingSalePackingList
\
Tic
\
Logout
\
"""
prepare_configured_instance
=
"""
\
InitializeTime"""
+
\
TestVifibSlapWebServiceMixin
.
prepare_destroy_requested_computer_partition
prepare_reported_usage_call
=
"""
\
SlapLoginCurrentComputer
\
SlapReportUsageCall
\
Tic
\
SlapLogout"""
def
stepInitializeTime
(
self
,
sequence
=
None
):
sequence
[
'start'
]
=
self
.
portal
.
portal_catalog
(
sort_on
=
(
'uid'
,
'DESC'
),
limit
=
1
)[
0
].
uid
sequence
[
'first_call'
]
=
False
sequence
[
'second_call'
]
=
False
def
stepSlapReportUsageCall
(
self
,
sequence
,
**
kw
):
"""
Checks that slap.reportUsage is successfully called.
"""
# We check if this is the first time that a node send a usage report
if
sequence
[
'first_call'
]
==
True
:
sequence
[
'second_call'
]
=
True
else
:
sequence
[
'first_call'
]
=
True
# We retrieve an example of XML report sent by a node
vifib_test_folder
=
self
.
getPortalObject
().
portal_skins
.
vifib_test
usage_string
=
\
vifib_test_folder
.
ERP5Site_getUsageReportTestSample
(
self
.
purchase_packing_list_quantity
)
sequence
[
'initial_xml'
]
=
usage_string
#We send the XML report to the Master
slap_object
=
slap
.
slap
()
slap_object
.
initializeConnection
(
self
.
server_url
)
slap_object
.
_connection_helper
.
POST
(
'/useComputer'
,
{
'computer_id'
:
sequence
[
'computer_reference'
],
'use_string'
:
usage_string
})
def
stepBuildSalePackingList
(
self
,
sequence
,
**
kw
):
"""
Builds Sale Packing List
"""
portal
=
self
.
getPortalObject
()
# We retrieve vifib_sale_invoice_builder object
portal_deliveries_object
=
\
portal
[
'portal_deliveries'
]
vifib_sale_invoice_builder
=
\
portal_deliveries_object
[
'vifib_sale_invoice_builder'
]
# Then, we build existing Sale Packing List
vifib_sale_invoice_builder
.
build
()
def
stepCheckCreatedSalePackingList
(
self
,
sequence
,
**
kw
):
"""
Checks that it is present in the system.
"""
#We retrieve the sale packing list module
sale_packing_list_portal_type
=
'Sale Packing List'
portal
=
self
.
getPortalObject
()
sale_packing_list_module
=
\
portal
.
getDefaultModule
(
sale_packing_list_portal_type
)
#We retrieve the Sale Packing List
sale_packing_list_list
=
sale_packing_list_module
.
searchFolder
(
title
=
'Resource consumptions'
,
uid
=
{
'query'
:
sequence
[
'start'
],
'range'
:
'min'
})
self
.
assertEqual
(
len
(
sale_packing_list_list
),
1
)
sale_packing_list
=
sale_packing_list_list
[
0
]
sequence
[
'sale_packing_list'
]
=
sale_packing_list
def
stepCheckCompleteSalePackingList
(
self
,
sequence
,
**
kw
):
"""
Checks if the Sale Packing List is properly completed
"""
#We retrieve the Sale Packing List Lines
sale_packing_list
=
sequence
[
'sale_packing_list'
]
xml
=
sale_packing_list
.
PackingList_generateUsageReport
()
initial_xml
=
sequence
[
'initial_xml'
]
#We parse XML reports to check if they are the same
parser
=
etree
.
XMLParser
(
remove_blank_text
=
True
)
initial_xml
=
etree
.
tostring
(
etree
.
XML
(
initial_xml
,
parser
))
xml
=
etree
.
tostring
(
etree
.
XML
(
xml
,
parser
))
sequence
.
edit
(
check_quantity
=
'first'
)
self
.
assertEqual
(
xml
,
initial_xml
)
def
stepCheckSaleInvoiceExists
(
self
,
sequence
,
**
kw
):
"""
Checks if a sale invoice exists.
"""
#We retrieve the Accounting module
accounting_portal_type
=
'Accounting'
portal
=
self
.
getPortalObject
()
accounting_module
=
\
portal
.
getDefaultModule
(
accounting_portal_type
)
#We retrieve the Sale Invoice
sale_invoice_list
=
accounting_module
.
searchFolder
(
title
=
'Resource consumptions'
,
uid
=
{
'query'
:
sequence
[
'start'
],
'range'
:
'min'
})
self
.
assertEqual
(
len
(
sale_invoice_list
),
self
.
sale_invoice_list_quantity
)
for
sale_invoice
in
sale_invoice_list
:
self
.
assertEqual
(
sale_invoice
.
getTitle
(),
'Resource consumptions'
)
self
.
assertEqual
(
sale_invoice
.
getSimulationState
(),
'planned'
)
sequence
.
edit
(
sale_invoice_list
=
sale_invoice_list
)
def
stepCheckSaleInvoiceQuantitySinglePartition
(
self
,
sequence
,
**
kw
):
"""
Checks quantities in the new sale invoice
"""
# We retrieve the sale invoice
sale_invoice
=
sequence
[
'sale_invoice_list'
]
self
.
assertEqual
(
len
(
sale_invoice
),
self
.
sale_invoice_list_quantity
)
sale_invoice_line_list
=
sale_invoice
[
0
].
getObject
().
contentValues
(
portal_type
=
'Invoice Line'
)
self
.
assertEqual
(
len
(
sale_invoice_line_list
),
self
.
sale_invoice_line_list_quantity
)
# Then, we check quantities in sale invoice's lines
for
sale_invoice_line
in
sale_invoice_line_list
:
self
.
assertEqual
(
sale_invoice_line
.
getQuantity
(),
self
.
sale_invoice_line_quantity
)
def
stepClearModules
(
self
,
sequence
,
**
kw
):
"""
Clear the Sale Packing List and Accounting Modules before to begin the other test
"""
portal
=
self
.
getPortalObject
()
module_portal_type_list
=
[
'Accounting'
,
'Sale Packing List'
]
for
module_portal_type
in
module_portal_type_list
:
module_object
=
\
portal
.
getDefaultModule
(
module_portal_type
)
result_tuple
=
module_object
.
searchFolder
(
title
=
'Resource consumptions'
,
uid
=
{
'query'
:
sequence
[
'start'
],
'range'
:
'min'
})
for
result
in
result_tuple
:
document
=
result
.
getObject
()
module_object
.
manage_delObjects
(
document
.
getId
())
def
stepCheckSaleInvoiceQuantityTwoPartitions
(
self
,
sequence
,
**
kw
):
"""
Checks quantities in new sale invoices
"""
# If this is the second call, we check if quantities have been doubled
if
sequence
[
'second_call'
]
==
True
:
quantity1
=
self
.
sale_invoice1_line_quantity
*
2
quantity2
=
self
.
sale_invoice2_line_quantity
*
2
else
:
quantity1
=
self
.
sale_invoice1_line_quantity
quantity2
=
self
.
sale_invoice2_line_quantity
# We retrieve sale invoice list
sale_invoice_list
=
sequence
[
'sale_invoice_list'
]
self
.
assertEqual
(
len
(
sale_invoice_list
),
self
.
sale_invoice_list_quantity
)
# We retrieve computer
computer_id
=
sequence
[
'computer_reference'
]
computer
=
self
.
getPortal
().
computer_module
.
searchFolder
(
reference
=
computer_id
)[
0
].
getObject
()
for
sale_invoice
in
sale_invoice_list
:
sale_invoice_line_list
=
\
sale_invoice
.
contentValues
(
portal_type
=
'Invoice Line'
)
# We check the number of line in sale invoices
self
.
assertEqual
(
len
(
sale_invoice_line_list
),
self
.
sale_invoice_line_list_quantity
)
# Then, we check quantities in these lines
for
sale_invoice_line
in
sale_invoice_line_list
:
partition_id
=
\
sale_invoice_line
.
getItemIdList
()[
0
]
partition_title
=
computer
.
searchFolder
(
id
=
partition_id
)[
0
].
getObject
().
getTitle
()
if
partition_title
==
'slappart0'
:
self
.
assertEqual
(
sale_invoice_line
.
getQuantity
(),
quantity1
)
else
:
self
.
assertEqual
(
sale_invoice_line
.
getQuantity
(),
quantity2
)
class
TestVifibUsageReport
(
TestVifibUsageReportMixin
):
def
getTitle
(
self
):
return
"testVifibUsageReport"
@
skip
(
'Ignored for now.'
)
def
test_usageReportWithSinglePartition
(
self
):
"""
Checks if useComputer method of SlapTool is properly called one time.
"""
self
.
computer_partition_amount
=
1
self
.
purchase_packing_list_quantity
=
1
self
.
sale_invoice_list_quantity
=
1
self
.
sale_invoice_line_list_quantity
=
2
self
.
sale_invoice_line_quantity
=
42.42
sequence_list
=
SequenceList
()
sequence_string
=
\
self
.
prepare_configured_instance
+
\
self
.
prepare_reported_usage_call
+
"""
\
LoginERP5TypeTestCase
\
BuildSalePackingList
\
Tic
\
CheckCreatedSalePackingList
\
CheckCompleteSalePackingList
\
CheckSaleInvoiceExists
\
CheckSaleInvoiceQuantitySinglePartition
\
ClearModules
\
Logout
LoginERP5TypeTestCase
CheckSiteConsistency
Logout
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
@
skip
(
'Ignored for now.'
)
def
test_usageReportWithTwoPartitions
(
self
):
"""
Checks if useComputer method of SlapTool is properly called two times.
"""
self
.
computer_partition_amount
=
2
self
.
purchase_packing_list_quantity
=
2
self
.
sale_invoice_list_quantity
=
2
self
.
sale_invoice_line_list_quantity
=
2
self
.
sale_invoice1_line_quantity
=
42.42
self
.
sale_invoice2_line_quantity
=
46.46
sequence_list
=
SequenceList
()
sequence_string
=
\
self
.
prepare_configured_instance
+
\
self
.
prepare_confirmed_cleanup_resource_packing_list2
+
\
self
.
prepare_reported_usage_call
+
"""
\
LoginERP5TypeTestCase
\
BuildSalePackingList
\
Tic
\
CheckCreatedSalePackingList
\
CheckCompleteSalePackingList
\
CheckSaleInvoiceExists
\
CheckSaleInvoiceQuantityTwoPartitions
\
Logout """
+
self
.
prepare_reported_usage_call
+
"""
\
LoginERP5TypeTestCase
\
BuildSalePackingList
\
Tic
\
CheckSaleInvoiceExists
\
CheckSaleInvoiceQuantityTwoPartitions
\
Logout
LoginERP5TypeTestCase
CheckSiteConsistency
Logout
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
master/product/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt
deleted
100644 → 0
View file @
a927cc96
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:define="form_title string:Add Vifib Browser ID Extraction Plugin"
tal:replace="structure context/manage_form_title">FORM TITLE</h2>
<p class="form-help">Please input the configuration</p>
<form action="addVifibBrowserIDExtractionPlugin" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="add plugin"/>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
master/product/Vifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt
deleted
100644 → 0
View file @
a927cc96
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:define="form_title string:Add ERP5 Facebook Server Extraction Plugin"
tal:replace="structure context/manage_form_title">FORM TITLE</h2>
<p class="form-help">Please input the configuration</p>
<form action="addVifibFacebookServerExtractionPlugin" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="add plugin"/>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
master/product/Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt
deleted
100644 → 0
View file @
a927cc96
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:define="form_title string:Add ERP5 Google Server Extraction Plugin"
tal:replace="structure context/manage_form_title">FORM TITLE</h2>
<p class="form-help">Please input the configuration</p>
<form action="addVifibGoogleServerExtractionPlugin" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="add plugin"/>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
master/product/Vifib/www/portal.gif
deleted
100644 → 0
View file @
a927cc96
281 Bytes
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