How to use update_router method in tempest

Best Python code snippet using tempest_python

test_routers_rbac.py

Source:test_routers_rbac.py Github

copy

Full Screen

...151 '"distributed" parameter not present in response body')152 @rbac_rule_validation.action(153 service="neutron", rule="update_router")154 @decorators.idempotent_id('3d182f4e-0023-4218-9aa0-ea2b0ae0bd7a')155 def test_update_router(self):156 """Update Router157 RBAC test for the neutron update_router policy158 """159 new_name = data_utils.rand_name(160 self.__class__.__name__ + '-new-router-name')161 self.rbac_utils.switch_role(self, toggle_rbac_role=True)162 self.routers_client.update_router(self.router['id'], name=new_name)163 @rbac_rule_validation.action(164 service="neutron", rule="update_router:external_gateway_info")165 @decorators.idempotent_id('5a6ae104-a9c3-4b56-8622-e1a0a0194474')166 def test_update_router_external_gateway_info(self):167 """Update Router External Gateway Info168 RBAC test for the neutron169 update_router:external_gateway_info policy170 """171 self.rbac_utils.switch_role(self, toggle_rbac_role=True)172 self.routers_client.update_router(self.router['id'],173 external_gateway_info={})174 @rbac_rule_validation.action(175 service="neutron",176 rule="update_router:external_gateway_info:network_id")177 @decorators.idempotent_id('f1fc5a23-e3d8-44f0-b7bc-47006ad9d3d4')178 def test_update_router_external_gateway_info_network_id(self):179 """Update Router External Gateway Info Network Id180 RBAC test for the neutron181 update_router:external_gateway_info:network_id policy182 """183 self.rbac_utils.switch_role(self, toggle_rbac_role=True)184 self.routers_client.update_router(185 self.router['id'],186 external_gateway_info={'network_id': self.network['id']})187 self.addCleanup(188 self.routers_client.update_router,189 self.router['id'],190 external_gateway_info=None)191 @test.requires_ext(extension='ext-gw-mode', service='network')192 @rbac_rule_validation.action(193 service="neutron",194 rule="update_router:external_gateway_info:enable_snat")195 @decorators.idempotent_id('515a2954-3d79-4695-aeb9-d1c222765840')196 def test_update_router_enable_snat(self):197 """Update Router External Gateway Info Enable Snat198 RBAC test for the neutron199 update_router:external_gateway_info:enable_snat policy200 """201 self.rbac_utils.switch_role(self, toggle_rbac_role=True)202 self.routers_client.update_router(203 self.router['id'],204 external_gateway_info={'network_id': self.network['id'],205 'enable_snat': True})206 self.addCleanup(207 self.routers_client.update_router,208 self.router['id'],209 external_gateway_info=None)210 @rbac_rule_validation.action(211 service="neutron",212 rule="update_router:external_gateway_info:external_fixed_ips")213 @decorators.idempotent_id('f429e5ee-8f0a-4667-963e-72dd95d5adee')214 def test_update_router_external_fixed_ips(self):215 """Update Router External Gateway Info External Fixed Ips216 RBAC test for the neutron217 update_router:external_gateway_info:external_fixed_ips policy218 """219 unused_ip = self._get_unused_ip_address()220 external_fixed_ips = {'subnet_id': self.subnet['id'],221 'ip_address': unused_ip}222 external_gateway_info = {'network_id': self.network['id'],223 'external_fixed_ips': [external_fixed_ips]}224 self.rbac_utils.switch_role(self, toggle_rbac_role=True)225 self.routers_client.update_router(226 self.router['id'],227 external_gateway_info=external_gateway_info)228 self.addCleanup(229 self.routers_client.update_router,230 self.router['id'],231 external_gateway_info=None)232 @decorators.idempotent_id('ddc20731-dea1-4321-9abf-8772bf0b5977')233 @test.requires_ext(extension='l3-ha', service='network')234 @rbac_rule_validation.action(service="neutron",235 rule="update_router:ha")236 def test_update_high_availability_router(self):237 """Update high-availability router238 RBAC test for the neutron update_router:ha policy239 """240 self.rbac_utils.switch_role(self, toggle_rbac_role=True)241 self.routers_client.update_router(self.router['id'], ha=True)242 self.addCleanup(self.routers_client.update_router, self.router['id'],243 ha=False)244 @decorators.idempotent_id('e1932c19-8f73-41cd-b5d2-84c7ae5d530c')245 @test.requires_ext(extension='dvr', service='network')246 @rbac_rule_validation.action(service="neutron",247 rule="update_router:distributed")248 def test_update_distributed_router(self):249 """Update distributed router250 RBAC test for the neutron update_router:distributed policy251 """252 self.rbac_utils.switch_role(self, toggle_rbac_role=True)253 self.routers_client.update_router(self.router['id'], distributed=True)254 self.addCleanup(self.routers_client.update_router, self.router['id'],255 distributed=False)256 @rbac_rule_validation.action(service="neutron",257 rule="delete_router",258 expected_error_code=404)259 @decorators.idempotent_id('c0634dd5-0467-48f7-a4ae-1014d8edb2a7')260 def test_delete_router(self):261 """Delete Router262 RBAC test for the neutron delete_router policy263 """264 router = self.create_router()265 self.rbac_utils.switch_role(self, toggle_rbac_role=True)266 self.routers_client.delete_router(router['id'])267 @rbac_rule_validation.action(service="neutron",...

Full Screen

Full Screen

urls.py

Source:urls.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from __future__ import unicode_literals3from django.conf import settings4from django.conf.urls import patterns, include, url5from django.conf.urls.static import static6from django.views.generic import TemplateView7# Uncomment the next two lines to enable the admin:8from django.contrib import admin9admin.autodiscover()10urlpatterns = patterns('',11 url(r'^$', # noqa12 TemplateView.as_view(template_name='pages/home.html'),13 name="home"),14 url(r'^about/$',15 TemplateView.as_view(template_name='pages/about.html'),16 name="about"),17 # Uncomment the next line to enable the admin:18 url(r'^admin/', include(admin.site.urls)),19 # User management20 url(r'^users/', include("users.urls", namespace="users")),21 url(r'^accounts/', include('allauth.urls')),22 # Uncomment the next line to enable avatars23 url(r'^avatar/', include('avatar.urls')),24 # Your stuff: custom urls go here25 url(r'^redactor/', include('redactor.urls')), 26 27 url(r'^k/', include('learningobjects.urls')),28 url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),29 url(r'^api-docs/', include('rest_framework_swagger.urls')), 30 31) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)32from rest_framework import routers33from api import views34#router.register(r'noticias', views.ResourceSearch, base_name='noticias')35#http://social.hontza.es/update/topic/", 36#http://social.hontza.es/update/collection/", 37#http://social.hontza.es/update/interest/"38import rest_framework39from rest_framework import reverse, response40class HybridRouter(routers.DefaultRouter):41 def __init__(self, *args, **kwargs):42 super(HybridRouter, self).__init__(*args, **kwargs)43 self._api_view_urls = {}44 def add_api_view(self, name, url):45 self._api_view_urls[name] = url46 def remove_api_view(self, name):47 del self._api_view_urls[name]48 @property49 def api_view_urls(self):50 ret = {}51 ret.update(self._api_view_urls)52 return ret53 def get_urls(self):54 urls = super(HybridRouter, self).get_urls()55 for api_view_key in self._api_view_urls.keys():56 urls.append(self._api_view_urls[api_view_key])57 return urls58 def get_api_root_view(self):59 # Copy the following block from Default Router60 api_root_dict = {}61 list_name = self.routes[0].name62 for prefix, viewset, basename in self.registry:63 api_root_dict[prefix] = list_name.format(basename=basename)64 api_view_urls = self._api_view_urls65 class APIRoot(rest_framework.views.APIView):66 _ignore_model_permissions = True67 def get(self, request, format=None):68 ret = {}69 for key, url_name in api_root_dict.items():70 ret[key] = reverse.reverse(url_name, request=request, format=format)71 # In addition to what had been added, now add the APIView urls72 for api_view_key in api_view_urls.keys():73 ret[api_view_key] = reverse.reverse(api_view_urls[api_view_key].name, request=request, format=format)74 return response.Response(ret)75 return APIRoot.as_view()76router = HybridRouter()77router.register(r'resources', views.ResourceViewSet)78router.register(r'collections', views.CollectionViewSet)79router.register(r'mentions', views.MentionViewSet)80router.register(r'profiles', views.ProfileViewSet)81router.register(r'topics', views.TopicViewSet)82router.register(r'relevance', views.RelevanceViewSet)83router.register(r'feeds', views.ResourceContainerViewSet)84update_router = HybridRouter()85update_router.register(r'collection', views.CollectionUpdateViewSet)86update_router.register(r'topic', views.TopicUpdateViewSet)87update_router.register(r'interest', views.InterestUpdateViewSet)88update_router.register(r'feed', views.ResourceContainerViewSet)89update_router.add_api_view('files', url(r'^files/$', views.AddFile.as_view(), name='files'))90update_router.add_api_view('file-instance',url(r'^files/(?P<pk>[\d]+)/$', views.FileInstanceView.as_view(), name='file-instance'))91urlpatterns += patterns('',92 url(r'search/', views.ResourceSearch.as_view()), 93 url(r'update/', include(update_router.urls)), 94 url(r'api/', include(router.urls)), ...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful