Ensure behavior of None for device_id

A simple unit test to ensure that we have had the same behavior
across releases WRT to explicitly passing None for device_id.

Change-Id: I153f3e1b4258f33c5fa3f16cc30a411052670b30
Related-Bug: #1681784
(cherry picked from commit 84d2d02762)
This commit is contained in:
Kevin Benton 2017-04-18 01:40:38 -07:00 committed by Ihar Hrachyshka
parent 639e1a46f5
commit 4d8685da80
1 changed files with 15 additions and 0 deletions

View File

@ -925,6 +925,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:
with self.subnet(network=network, cidr='10.0.0.0/24') as subnet: