Fixes bug 871877
Added an aditional testunit to the VlanNetworkTestCase to check if the FixedIpNotFoundForNetwork exception is raised properly. Change-Id: I92a0ca22aadcfa9a7fd434375e239be8ccf4f387
This commit is contained in:
		
							
								
								
									
										1
									
								
								Authors
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Authors
									
									
									
									
									
								
							| @@ -4,6 +4,7 @@ Adam Johnson <adjohn@gmail.com> | |||||||
| Ahmad Hassan <ahmad.hassan@hp.com> | Ahmad Hassan <ahmad.hassan@hp.com> | ||||||
| Alex Meade <alex.meade@rackspace.com> | Alex Meade <alex.meade@rackspace.com> | ||||||
| Alexander Sakhnov <asakhnov@mirantis.com> | Alexander Sakhnov <asakhnov@mirantis.com> | ||||||
|  | Alvaro Lopez Garcia <aloga@ifca.unican.es> | ||||||
| Andrey Brindeyev <abrindeyev@griddynamics.com> | Andrey Brindeyev <abrindeyev@griddynamics.com> | ||||||
| Andy Smith <code@term.ie> | Andy Smith <code@term.ie> | ||||||
| Andy Southgate <andy.southgate@citrix.com> | Andy Southgate <andy.southgate@citrix.com> | ||||||
|   | |||||||
| @@ -298,6 +298,7 @@ class VlanNetworkTestCase(test.TestCase): | |||||||
|                               'virtual_interface_get_by_instance_and_network') |                               'virtual_interface_get_by_instance_and_network') | ||||||
|  |  | ||||||
|         db.fixed_ip_associate(mox.IgnoreArg(), |         db.fixed_ip_associate(mox.IgnoreArg(), | ||||||
|  |                               mox.IgnoreArg(), | ||||||
|                               mox.IgnoreArg(), |                               mox.IgnoreArg(), | ||||||
|                               mox.IgnoreArg(), |                               mox.IgnoreArg(), | ||||||
|                               reserved=True).AndReturn('192.168.0.1') |                               reserved=True).AndReturn('192.168.0.1') | ||||||
| @@ -312,6 +313,19 @@ class VlanNetworkTestCase(test.TestCase): | |||||||
|         network['vpn_private_address'] = '192.168.0.2' |         network['vpn_private_address'] = '192.168.0.2' | ||||||
|         self.network.allocate_fixed_ip(None, 0, network, vpn=True) |         self.network.allocate_fixed_ip(None, 0, network, vpn=True) | ||||||
|  |  | ||||||
|  |     def test_vpn_allocate_fixed_ip_no_network_id(self): | ||||||
|  |         network = dict(networks[0]) | ||||||
|  |         network['vpn_private_address'] = '192.168.0.2' | ||||||
|  |         network['id'] = None | ||||||
|  |         context_admin = context.RequestContext('testuser', 'testproject', | ||||||
|  |                 is_admin=True) | ||||||
|  |         self.assertRaises(exception.FixedIpNotFoundForNetwork, | ||||||
|  |                 self.network.allocate_fixed_ip, | ||||||
|  |                 context_admin, | ||||||
|  |                 0, | ||||||
|  |                 network, | ||||||
|  |                 vpn=True) | ||||||
|  |  | ||||||
|     def test_allocate_fixed_ip(self): |     def test_allocate_fixed_ip(self): | ||||||
|         self.mox.StubOutWithMock(db, 'fixed_ip_associate_pool') |         self.mox.StubOutWithMock(db, 'fixed_ip_associate_pool') | ||||||
|         self.mox.StubOutWithMock(db, 'fixed_ip_update') |         self.mox.StubOutWithMock(db, 'fixed_ip_update') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alvaro Lopez
					Alvaro Lopez