shoop.testing package¶
Subpackages¶
Submodules¶
shoop.testing.factories module¶
-
class
shoop.testing.factories.
FuzzyBoolean
(probability, **kwargs)[source]¶ Bases:
factory.fuzzy.BaseFuzzyAttribute
-
class
shoop.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
shoop.testing.factories.
CompanyFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
vat_id
= <factory.fuzzy.FuzzyText object>¶
-
email
= <factory.declarations.Sequence object>¶
-
-
class
shoop.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
shoop.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
shoop.testing.factories.
SalesUnitFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
short_name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shoop.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
shoop.testing.factories.
ShopProductFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
visible
= <shoop.testing.factories.FuzzyBoolean object>¶
-
listed
= <shoop.testing.factories.FuzzyBoolean object>¶
-
purchasable
= <shoop.testing.factories.FuzzyBoolean object>¶
-
searchable
= <shoop.testing.factories.FuzzyBoolean object>¶
-
default_price_value
= <factory.fuzzy.FuzzyDecimal object>¶
-
-
class
shoop.testing.factories.
FuzzyName
(prefix='', length=12, suffix='', chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', **kwargs)[source]¶ Bases:
factory.fuzzy.FuzzyText
-
class
shoop.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
= <shoop.testing.factories.FuzzyName object>¶
-
post
= <factory.declarations.PostGeneration object>¶
-
-
shoop.testing.factories.
get_payment_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shoop.testing.factories.
get_shipping_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shoop.testing.factories.
create_product
(sku, shop=None, supplier=None, default_price=None, **attrs)[source]¶
-
shoop.testing.factories.
add_product_to_order
(order, supplier, product, quantity, taxless_base_unit_price, tax_rate=0, pricing_context=None)[source]¶
-
shoop.testing.factories.
create_order_with_product
(product, supplier, quantity, taxless_base_unit_price, tax_rate=0, n_lines=1, shop=None)[source]¶
-
shoop.testing.factories.
create_random_person
(locale=None, minimum_name_comp_len=0)[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:
shoop.testing.image_generator module¶
-
class
shoop.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
shoop.testing.image_generator.
RandomImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.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
shoop.testing.image_generator.
ModernArtImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.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
shoop.testing.image_generator.
RingImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.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
shoop.testing.mock_population module¶
shoop.testing.service_forms module¶
-
class
shoop.testing.service_forms.
PseudoPaymentProcessorForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
PseudoPaymentProcessorForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7f52fe88a7b8>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7f52fe88a630>), ('bg_color', <django.forms.fields.CharField object at 0x7f52fe88a5f8>), ('fg_color', <django.forms.fields.CharField object at 0x7f52fe88a2e8>), ('name', <django.forms.fields.CharField object at 0x7f52fe901cc0>)])¶
-
PseudoPaymentProcessorForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7f52fe901cc0>)])¶
-
PseudoPaymentProcessorForm.
media
¶
-
-
class
shoop.testing.service_forms.
PaymentWithCheckoutPhaseForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
PaymentWithCheckoutPhase
-
exclude
= ['identifier']¶
-
-
PaymentWithCheckoutPhaseForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7f52fe88aac8>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7f52fe88ab70>), ('name', <django.forms.fields.CharField object at 0x7f52fe88a198>)])¶
-
PaymentWithCheckoutPhaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7f52fe88a198>)])¶
-
PaymentWithCheckoutPhaseForm.
media
¶
-
class
-
class
shoop.testing.service_forms.
CarrierWithCheckoutPhaseForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
CarrierWithCheckoutPhase
-
exclude
= ['identifier']¶
-
-
CarrierWithCheckoutPhaseForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7f52fe88acf8>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7f52fe88ae80>), ('name', <django.forms.fields.CharField object at 0x7f53000d54a8>)])¶
-
CarrierWithCheckoutPhaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7f53000d54a8>)])¶
-
CarrierWithCheckoutPhaseForm.
media
¶
-
class
shoop.testing.simple_checkout_phase module¶
-
class
shoop.testing.simple_checkout_phase.
TestPaymentCheckoutPhaseForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('input_field', <django.forms.fields.BooleanField object at 0x7f52fe8dba58>)])¶
-
declared_fields
= OrderedDict([('input_field', <django.forms.fields.BooleanField object at 0x7f52fe8dba58>)])¶
-
media
¶
-
-
class
shoop.testing.simple_checkout_phase.
TestShipmentCheckoutPhaseForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('input_field', <django.forms.fields.CharField object at 0x7f52ffc80cf8>)])¶
-
declared_fields
= OrderedDict([('input_field', <django.forms.fields.CharField object at 0x7f52ffc80cf8>)])¶
-
media
¶
-
-
class
shoop.testing.simple_checkout_phase.
TestMethodCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop_testing/simple_checkout_phase.jinja'¶
-
data_attribute
= None¶
-
storage_identifier
= None¶
-
-
class
shoop.testing.simple_checkout_phase.
TestPaymentCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.testing.simple_checkout_phase.TestMethodCheckoutPhase
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'test_payment_phase'¶
-
title
= 'Test Payment Phase'¶
-
form_class
¶ alias of
TestPaymentCheckoutPhaseForm
-
storage_identifier
= 'payment_with_checkout_phase'¶
-
data_attribute
= 'payment_data'¶
-
-
class
shoop.testing.simple_checkout_phase.
TestShipmentCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.testing.simple_checkout_phase.TestMethodCheckoutPhase
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'test_shipment_phase'¶
-
title
= 'Test Shipment Phase'¶
-
form_class
¶ alias of
TestShipmentCheckoutPhaseForm
-
storage_identifier
= 'shipment_with_checkout_phase'¶
-
data_attribute
= 'shipping_data'¶
-
-
class
shoop.testing.simple_checkout_phase.
PaymentPhaseProvider
[source]¶ Bases:
shoop.front.checkout.BasicServiceCheckoutPhaseProvider
-
phase_class
¶ alias of
TestPaymentCheckoutPhase
-
service_provider_class
¶ alias of
PaymentWithCheckoutPhase
-
-
class
shoop.testing.simple_checkout_phase.
ShipmentPhaseProvider
[source]¶ Bases:
shoop.front.checkout.BasicServiceCheckoutPhaseProvider
-
phase_class
¶ alias of
TestShipmentCheckoutPhase
-
service_provider_class
¶ alias of
CarrierWithCheckoutPhase
-
shoop.testing.soup_utils module¶
shoop.testing.text_data module¶
shoop.testing.utils module¶
-
shoop.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:
Module contents¶
-
class
shoop.testing.
ShoopTestingAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.testing'¶
-
verbose_name
= 'Shoop Testing & Demo Utilities'¶
-
label
= 'shoop_testing'¶
-
provides
= {'front_service_checkout_phase_provider': ['shoop.testing.simple_checkout_phase.PaymentPhaseProvider', 'shoop.testing.simple_checkout_phase.ShipmentPhaseProvider'], 'service_provider_admin_form': ['shoop.testing.service_forms:PseudoPaymentProcessorForm', 'shoop.testing.service_forms:PaymentWithCheckoutPhaseForm', 'shoop.testing.service_forms:CarrierWithCheckoutPhaseForm'], 'admin_module': ['shoop.testing.admin_module:TestingAdminModule']}¶
-