Merge "Ensure behavior of None for device_id"

This commit is contained in:
Jenkins 2017-04-19 00:19:35 +00:00 committed by Gerrit Code Review
commit 527e148fb7
1 changed files with 15 additions and 0 deletions

View File

@ -947,6 +947,21 @@ class TestPortsV2(NeutronDbPluginV2TestCase):
self.assertIn('mac_address', port['port'])
self._delete('ports', port['port']['id'])
def test_create_port_None_values(self):
with self.network() as network:
keys = ['device_owner', 'name', 'device_id']
for key in keys:
# test with each as None and rest as ''
kwargs = {k: '' for k in keys}
kwargs[key] = None
self._create_port(self.fmt,
network['network']['id'],
webob.exc.HTTPClientError.code,
tenant_id='tenant_id',
fixed_ips=[],
set_context=False,
**kwargs)
def test_create_port_public_network_with_ip(self):
with self.network(shared=True) as network:
ip_net = netaddr.IPNetwork('10.0.0.0/24')