Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 2 | |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | from tempest.api.baremetal import base |
| 16 | from tempest.common.utils import data_utils |
| 17 | from tempest import exceptions as exc |
| 18 | from tempest import test |
| 19 | |
| 20 | |
| 21 | class TestPortsNegative(base.BaseBaremetalTest): |
| 22 | """Negative tests for ports.""" |
| 23 | |
| 24 | def setUp(self): |
| 25 | super(TestPortsNegative, self).setUp() |
| 26 | |
| 27 | chassis = self.create_chassis()['chassis'] |
| 28 | self.node = self.create_node(chassis['uuid'])['node'] |
| 29 | |
| 30 | @test.attr(type='negative') |
| 31 | def test_create_port_invalid_mac(self): |
| 32 | node_id = self.node['uuid'] |
| 33 | address = 'not an uuid' |
| 34 | |
| 35 | self.assertRaises(exc.BadRequest, |
| 36 | self.create_port, node_id=node_id, address=address) |
| 37 | |
| 38 | @test.attr(type='negative') |
| 39 | def test_create_port_wrong_node_id(self): |
| 40 | node_id = str(data_utils.rand_uuid()) |
| 41 | |
| 42 | self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id) |