summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/admin/networks/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack_dashboard/dashboards/admin/networks/tests.py')
-rw-r--r--openstack_dashboard/dashboards/admin/networks/tests.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py
index f3e4312..34f64af 100644
--- a/openstack_dashboard/dashboards/admin/networks/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/tests.py
@@ -464,6 +464,9 @@ class NetworkTests(test.BaseAdminViewTests):
464 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\ 464 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\
465 MultipleTimes().AndReturn(True) 465 MultipleTimes().AndReturn(True)
466 api.neutron.is_extension_supported(IsA(http.HttpRequest), 466 api.neutron.is_extension_supported(IsA(http.HttpRequest),
467 'network_availability_zone').\
468 MultipleTimes().AndReturn(False)
469 api.neutron.is_extension_supported(IsA(http.HttpRequest),
467 'subnet_allocation').\ 470 'subnet_allocation').\
468 MultipleTimes().AndReturn(True) 471 MultipleTimes().AndReturn(True)
469 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\ 472 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\
@@ -486,6 +489,57 @@ class NetworkTests(test.BaseAdminViewTests):
486 self.assertRedirectsNoFollow(res, INDEX_URL) 489 self.assertRedirectsNoFollow(res, INDEX_URL)
487 490
488 @test.create_stubs({api.neutron: ('network_create', 491 @test.create_stubs({api.neutron: ('network_create',
492 'is_extension_supported',
493 'list_availability_zones',
494 'subnetpool_list'),
495 api.keystone: ('tenant_list',)})
496 def test_network_create_post_with_az(self):
497 tenants = self.tenants.list()
498 tenant_id = self.tenants.first().id
499 network = self.networks.first()
500
501 api.keystone.tenant_list(IsA(http.HttpRequest))\
502 .AndReturn([tenants, False])
503 params = {'name': network.name,
504 'tenant_id': tenant_id,
505 'admin_state_up': network.admin_state_up,
506 'router:external': True,
507 'shared': True,
508 'provider:network_type': 'local',
509 'with_subnet': False,
510 'az_hints': ['nova']}
511 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\
512 MultipleTimes().AndReturn(True)
513 api.neutron.is_extension_supported(IsA(http.HttpRequest),
514 'network_availability_zone').\
515 MultipleTimes().AndReturn(True)
516 api.neutron.list_availability_zones(IsA(http.HttpRequest),
517 "network", "available")\
518 .AndReturn(self.neutron_availability_zones.list())
519 api.neutron.is_extension_supported(IsA(http.HttpRequest),
520 'subnet_allocation').\
521 MultipleTimes().AndReturn(True)
522 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\
523 AndReturn(self.subnetpools.list())
524 api.neutron.network_create(IsA(http.HttpRequest), **params)\
525 .AndReturn(network)
526
527 self.mox.ReplayAll()
528
529 form_data = {'tenant_id': tenant_id,
530 'name': network.name,
531 'admin_state': network.admin_state_up,
532 'external': True,
533 'shared': True,
534 'network_type': 'local',
535 'availability_zone_hints': ['nova']}
536 url = reverse('horizon:admin:networks:create')
537 res = self.client.post(url, form_data)
538
539 self.assertNoFormErrors(res)
540 self.assertRedirectsNoFollow(res, INDEX_URL)
541
542 @test.create_stubs({api.neutron: ('network_create',
489 'subnet_create', 543 'subnet_create',
490 'is_extension_supported', 544 'is_extension_supported',
491 'subnetpool_list'), 545 'subnetpool_list'),
@@ -509,6 +563,9 @@ class NetworkTests(test.BaseAdminViewTests):
509 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\ 563 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\
510 MultipleTimes().AndReturn(True) 564 MultipleTimes().AndReturn(True)
511 api.neutron.is_extension_supported(IsA(http.HttpRequest), 565 api.neutron.is_extension_supported(IsA(http.HttpRequest),
566 'network_availability_zone').\
567 MultipleTimes().AndReturn(False)
568 api.neutron.is_extension_supported(IsA(http.HttpRequest),
512 'subnet_allocation').\ 569 'subnet_allocation').\
513 MultipleTimes().AndReturn(True) 570 MultipleTimes().AndReturn(True)
514 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\ 571 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\
@@ -552,6 +609,9 @@ class NetworkTests(test.BaseAdminViewTests):
552 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\ 609 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\
553 MultipleTimes().AndReturn(True) 610 MultipleTimes().AndReturn(True)
554 api.neutron.is_extension_supported(IsA(http.HttpRequest), 611 api.neutron.is_extension_supported(IsA(http.HttpRequest),
612 'network_availability_zone').\
613 MultipleTimes().AndReturn(False)
614 api.neutron.is_extension_supported(IsA(http.HttpRequest),
555 'subnet_allocation').\ 615 'subnet_allocation').\
556 MultipleTimes().AndReturn(True) 616 MultipleTimes().AndReturn(True)
557 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\ 617 api.neutron.subnetpool_list(IsA(http.HttpRequest)).\
@@ -581,6 +641,9 @@ class NetworkTests(test.BaseAdminViewTests):
581 api.keystone.tenant_list( 641 api.keystone.tenant_list(
582 IsA(http.HttpRequest) 642 IsA(http.HttpRequest)
583 ).MultipleTimes().AndReturn([tenants, False]) 643 ).MultipleTimes().AndReturn([tenants, False])
644 api.neutron.is_extension_supported(IsA(http.HttpRequest),
645 'network_availability_zone').\
646 MultipleTimes().AndReturn(False)
584 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider')\ 647 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider')\
585 .MultipleTimes().AndReturn(True) 648 .MultipleTimes().AndReturn(True)
586 649
@@ -611,6 +674,9 @@ class NetworkTests(test.BaseAdminViewTests):
611 IsA(http.HttpRequest) 674 IsA(http.HttpRequest)
612 ).MultipleTimes().AndReturn([tenants, False]) 675 ).MultipleTimes().AndReturn([tenants, False])
613 676
677 api.neutron.is_extension_supported(IsA(http.HttpRequest),
678 'network_availability_zone').\
679 MultipleTimes().AndReturn(False)
614 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\ 680 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider').\
615 MultipleTimes().AndReturn(True) 681 MultipleTimes().AndReturn(True)
616 self.mox.ReplayAll() 682 self.mox.ReplayAll()
@@ -642,6 +708,9 @@ class NetworkTests(test.BaseAdminViewTests):
642 IsA(http.HttpRequest) 708 IsA(http.HttpRequest)
643 ).MultipleTimes().AndReturn([tenants, False]) 709 ).MultipleTimes().AndReturn([tenants, False])
644 710
711 api.neutron.is_extension_supported(IsA(http.HttpRequest),
712 'network_availability_zone').\
713 MultipleTimes().AndReturn(False)
645 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider')\ 714 api.neutron.is_extension_supported(IsA(http.HttpRequest), 'provider')\
646 .MultipleTimes().AndReturn(True) 715 .MultipleTimes().AndReturn(True)
647 716