shuup.testing package¶
Subpackages¶
- shuup.testing.management package
- shuup.testing.models package
- shuup.testing.modules package
- shuup.testing.supplier_pricing package
- shuup.testing.themes package
Submodules¶
shuup.testing.basket_middleware module¶
-
class
shuup.testing.basket_middleware.
TestBasketCommandMiddleware
[source]¶ Bases:
shuup.core.basket.command_middleware.BaseBasketCommandMiddleware
shuup.testing.browser_utils module¶
shuup.testing.checkout_with_login_and_register_urls module¶
shuup.testing.extend_classes module¶
shuup.testing.factories module¶
-
class
shuup.testing.factories.
FuzzyBoolean
(probability, **kwargs)[source]¶ Bases:
factory.fuzzy.BaseFuzzyAttribute
-
class
shuup.testing.factories.
UserFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
username
= <factory.declarations.Sequence object>¶
-
email
= <factory.declarations.Sequence object>¶
-
password
= <factory.declarations.PostGenerationMethodCall object>¶
-
first_name
= <factory.fuzzy.FuzzyText object>¶
-
last_name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shuup.testing.factories.
CompanyFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
tax_number
= <factory.fuzzy.FuzzyText object>¶
-
email
= <factory.declarations.Sequence object>¶
-
-
class
shuup.testing.factories.
ShopFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
slug
= <factory.fuzzy.FuzzyText object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
owner
= <factory.declarations.SubFactory object>¶
-
-
class
shuup.testing.factories.
ProductTypeFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
identifier
= <factory.declarations.Sequence object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shuup.testing.factories.
SalesUnitFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
symbol
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shuup.testing.factories.
CategoryFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
identifier
= <factory.declarations.Sequence object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
status
= <factory.fuzzy.FuzzyChoice object>¶
-
post
= <factory.declarations.PostGeneration object>¶
-
-
class
shuup.testing.factories.
ShopProductFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
purchasable
= <shuup.testing.factories.FuzzyBoolean object>¶
-
visibility
= <factory.fuzzy.FuzzyChoice object>¶
-
default_price_value
= <factory.fuzzy.FuzzyDecimal object>¶
-
-
class
shuup.testing.factories.
FuzzyName
(prefix='', length=12, suffix='', chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', **kwargs)[source]¶ Bases:
factory.fuzzy.FuzzyText
-
class
shuup.testing.factories.
ProductFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
type
= <factory.declarations.LazyAttribute object>¶
-
sku
= <factory.fuzzy.FuzzyText object>¶
-
sales_unit
= <factory.declarations.LazyAttribute object>¶
-
tax_class
= <factory.declarations.LazyAttribute object>¶
-
profit_center
= <factory.fuzzy.FuzzyInteger object>¶
-
cost_center
= <factory.fuzzy.FuzzyInteger object>¶
-
name
= <shuup.testing.factories.FuzzyName object>¶
-
post
= <factory.declarations.PostGeneration object>¶
-
-
shuup.testing.factories.
get_payment_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shuup.testing.factories.
get_shipping_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shuup.testing.factories.
get_shop
(prices_include_tax=True, currency='EUR', identifier=None, enabled=False, **kwargs)[source]¶
-
shuup.testing.factories.
create_attribute_with_options
(name, options, min_options=0, max_options=0)[source]¶
-
shuup.testing.factories.
create_product
(sku, shop=None, supplier=None, default_price=None, **attrs)[source]¶
-
shuup.testing.factories.
create_package_product
(sku, shop=None, supplier=None, default_price=None, children=4, **attrs)[source]¶
-
shuup.testing.factories.
add_product_to_order
(order, supplier, product, quantity, taxless_base_unit_price, tax_rate=0, pricing_context=None)[source]¶
-
shuup.testing.factories.
create_order_with_product
(product, supplier, quantity, taxless_base_unit_price, tax_rate=0, n_lines=1, shop=None)[source]¶
-
shuup.testing.factories.
create_random_person
(locale='en', minimum_name_comp_len=0, shop=None)[source]¶ Create a random PersonContact from the given locale (or a random one).
The minimum length for name components can be given, to work around possible issues with components expecting a long-enough string.
Parameters: - locale (str|None) – Locale name.
- minimum_name_comp_len (int) – Minimum name component length.
Returns: Person contact.
Return type:
shuup.testing.image_generator module¶
-
class
shuup.testing.image_generator.
BaseImageGenerator
(image, palette, seed)[source]¶ Bases:
object
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shuup.testing.image_generator.
RandomImageGenerator
(image, palette, seed)[source]¶ Bases:
shuup.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shuup.testing.image_generator.
ModernArtImageGenerator
(image, palette, seed)[source]¶ Bases:
shuup.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shuup.testing.image_generator.
RingImageGenerator
(image, palette, seed)[source]¶ Bases:
shuup.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
shuup.testing.importers module¶
-
class
shuup.testing.importers.
DummyImporter
(data, context)[source]¶ Bases:
shuup.importer.importing.importing.DataImporter
-
identifier
= 'dummy_importer'¶
-
name
= 'Dummy Importer'¶
-
model
¶ alias of
Contact
-
example_files
= [<shuup.importer.importing.importing.ImporterExampleFile object>]¶
-
shuup.testing.line_properties_descriptor module¶
-
class
shuup.testing.line_properties_descriptor.
TestLinePropertiesDescriptor
[source]¶ Bases:
shuup.front.utils.order_source.BaseLinePropertiesDescriptor
shuup.testing.mock_population module¶
shuup.testing.notify_script_templates module¶
-
class
shuup.testing.notify_script_templates.
DummyScriptTemplate
(script_instance=None)[source]¶ Bases:
shuup.notify.base.ScriptTemplate
Parameters: script_instance (shuup.notify.models.script.Script|None) – script instance to change or None -
identifier
= 'dummy_script_template'¶
-
name
= 'A Dummy Script Template'¶
-
description
= 'More Texts'¶
-
help_text
= 'A good help here'¶
-
shuup.testing.receivers module¶
-
shuup.testing.receivers.
shop_product_orderability_check
(sender, **kwargs)[source]¶ Signal handler for detecting shop product orderability changes
For projects which purchasable doesn’t change based on contact or contact group can hide unorderable products from frontend by changing the product visibility. By default Shuup shows all visible products at front which might not be desired for all projects.
Orderability can depend on contact or contact group only when some custom supplier modules are included. In these cases the project orderability signal handler has to adapt accordingly.
shuup.testing.service_forms module¶
shuup.testing.shop_provider module¶
shuup.testing.simple_checkout_phase module¶
shuup.testing.single_page_checkout_test_urls module¶
shuup.testing.single_page_checkout_with_login_and_register_conf module¶
-
class
shuup.testing.single_page_checkout_with_login_and_register_conf.
SinglePageCheckoutViewWithLoginAndRegister
(**kwargs)[source]¶ Bases:
shuup.front.views.checkout.SinglePageCheckoutView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
initial_phase
= 'checkout_method'¶
-
phase_specs
= ['shuup.front.checkout.checkout_method:CheckoutMethodPhase', 'shuup.front.checkout.checkout_method:RegisterPhase', 'shuup.front.checkout.addresses:AddressesPhase', 'shuup.front.checkout.methods:MethodsPhase', 'shuup.front.checkout.methods:ShippingMethodPhase', 'shuup.front.checkout.methods:PaymentMethodPhase', 'shuup.front.checkout.confirm:ConfirmPhase']¶
-
empty_phase_spec
= 'shuup.front.checkout.empty:EmptyPhase'¶
-
shuup.testing.soup_utils module¶
shuup.testing.subscription_option_provider module¶
-
class
shuup.testing.subscription_option_provider.
TestSubscriptionOptionProvider
[source]¶ Bases:
shuup.core.utils.product_subscription.BaseProductSubscriptionOptionProvider
shuup.testing.supplier_provider module¶
shuup.testing.text_data module¶
shuup.testing.utils module¶
-
shuup.testing.utils.
apply_request_middleware
(request, **attrs)[source]¶ Apply all the
process_request
capable middleware configured into the given request.Parameters: - request (django.http.HttpRequest) – The request to massage.
- attrs (dict) – Additional attributes to set after massage.
Returns: The same request, massaged in-place.
Return type: django.http.HttpRequest
-
shuup.testing.utils.
apply_view_middleware
(request)[source]¶ Apply all the
process_view
capable middleware configured into the given request.The logic is roughly copied from django.core.handlers.base.BaseHandler.get_response
Parameters: request (django.http.HttpRequest) – The request to massage. Returns: The same request, massaged in-place. Return type: django.http.HttpRequest
-
shuup.testing.utils.
apply_all_middleware
(request, **attrs)[source]¶ Apply all the
process_request
andprocess_view
capable middleware configured into the given request.Parameters: - request (django.http.HttpRequest) – The request to massage.
- attrs (dict) – Additional attributes to set to the request after massage.
Returns: The same request, massaged in-place.
Return type: django.http.HttpRequest
Module contents¶
-
shuup.testing.
activate_sqlite_fk_constraint
(sender, connection, **kwargs)[source]¶ Enable integrity constraint with SQLite and not running browser tests.
-
class
shuup.testing.
ShuupTestingAppConfig
(*args, **kwargs)[source]¶ Bases:
shuup.apps.AppConfig
-
name
= 'shuup.testing'¶
-
verbose_name
= 'Shuup Testing & Demo Utilities'¶
-
label
= 'shuup_testing'¶
-
provides
= {'admin_module': ['shuup.testing.modules.mocker:TestingAdminModule', 'shuup.testing.modules.sample_data:SampleDataAdminModule', 'shuup.testing.modules.demo:DemoModule'], 'service_provider_admin_form': ['shuup.testing.service_forms:PseudoPaymentProcessorForm', 'shuup.testing.service_forms:PaymentWithCheckoutPhaseForm', 'shuup.testing.service_forms:CarrierWithCheckoutPhaseForm'], 'front_service_checkout_phase_provider': ['shuup.testing.simple_checkout_phase.PaymentPhaseProvider', 'shuup.testing.simple_checkout_phase.ShipmentPhaseProvider'], 'admin_contact_toolbar_button': ['shuup.testing.modules.mocker.toolbar:MockContactToolbarButton'], 'admin_contact_toolbar_action_item': ['shuup.testing.modules.mocker.toolbar:MockContactToolbarActionItem'], 'admin_contact_edit_toolbar_button': ['shuup.testing.modules.mocker.toolbar:MockContactToolbarButton'], 'admin_shop_edit_toolbar_button': ['shuup.testing.modules.mocker.toolbar:MockShopToolbarButton'], 'admin_product_toolbar_action_item': ['shuup.testing.modules.mocker.toolbar:MockProductToolbarActionItem'], 'admin_contact_section': ['shuup.testing.modules.mocker.sections:MockContactSection'], 'importers': ['shuup.testing.importers.DummyImporter', 'shuup.testing.importers.DummyFileImporter'], 'xtheme': ['shuup.testing.themes:ShuupTestingTheme', 'shuup.testing.themes:ShuupTestingThemeWithCustomBase'], 'pricing_module': ['shuup.testing.supplier_pricing.pricing:SupplierPricingModule']}¶
-