Best Python code snippet using localstack_python
test_registry.py
Source:test_registry.py
...9 Calling register correctly adds the integration10 """11 registry = Registry()12 assert len(registry.integrations) == 013 integration = get_integration(register=False)14 registry.register(integration)15 assert len(registry.integrations) == 116 assert integration.name in registry.integrations17def test_get(get_integration):18 """19 Calling get correctly fetches the integration (both by name and instance)20 """21 registry = Registry()22 integration = get_integration(is_local=False, register=False)23 registry.register(integration)24 assert registry.get(integration) == integration25 assert registry.get(integration.name) == integration26 with pytest.raises(Registry.IntegrationUnavailableException):27 registry.get(get_integration(is_local=True, register=False))28 with pytest.raises(ValueError):29 registry.get(2)30def test_get_all(get_integration):31 """32 Calling get_all correctly returns all, local or non-local integration sets33 """34 registry = Registry()35 integration1 = get_integration(is_local=True, register=False)36 registry.register(integration1)37 integration2 = get_integration(is_local=False, register=False)38 registry.register(integration2)39 assert registry.get_all() == {integration1(), integration2()}40 assert registry.get_all(is_local=True) == {integration1()}41 assert registry.get_all(is_local=False) == {integration2()}42def test_get_all_with_implements(get_integration):43 """44 Calling ``get_all`` with ``implements`` correctly returns all, local or non-local45 integration sets that inherit from all the classes in ``implements``.46 """47 registry = Registry()48 integration1 = get_integration(is_local=True, register=False)49 registry.register(integration1)50 integration2 = get_integration(is_local=False, register=False)51 registry.register(integration2)52 assert registry.get_all(TestLocalIntegration) == {integration1()}53 assert registry.get_all(TestInternalIntegration) == {integration2()}54 assert registry.get_all(TestInternalIntegration, TestLocalIntegration) == set()55 with pytest.raises(TypeError):56 registry.get_all(integration2())57def test_get_urls():58 """59 Calling get_urls returns an URLConf with the correctly formed paths pointing to60 their corresponding views61 """62 registry = Registry()63 mock_request_handler = lambda request: None # noqa: E73164 class TestIntegration(BaseIntegration):...
urls.py
Source:urls.py
1from django.conf.urls import *2from billing import get_integration3from django.views.decorators.csrf import csrf_exempt4from django.views.generic import TemplateView5authorize_net_obj = get_integration("authorize_net_dpm")6pay_pal_obj = get_integration("pay_pal")7amazon_fps_obj = get_integration("fps")8fps_recur_obj = get_integration("fps")9world_pay_obj = get_integration("world_pay")10braintree_obj = get_integration("braintree_payments")11stripe_obj = get_integration("stripe_example")12ogone_obj = get_integration("ogone_payments")13urlpatterns = patterns('app.views',14 url(r'^$', 'index', name='app_index'),15 url(r'^authorize/$', 'authorize', name='app_authorize'),16 url(r'^paypal/$', 'paypal', name='app_paypal'),17 url(r'^eway/$', 'eway', name='app_eway'),18 url(r'^braintree/$', 'braintree', name='app_braintree'),19 url(r'^stripe/$', 'stripe', name='app_stripe'),20 url(r'^paylane/$', 'paylane', name='app_paylane'),21 url(r'^beanstream/$', 'beanstream', name='app_beanstream'),22 url(r'^chargebee/$', 'chargebee', name='app_chargebee'),23 url(r'^bitcoin/$', 'bitcoin', name='app_bitcoin'),24 url(r'^bitcoin/done/$', 'bitcoin_done', name='app_bitcoin_done'),25)26# offsite payments...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!