| 1 |
# Copyright 2013 Intel |
| 2 |
# Copyright 2013 Isaku Yamahata <isaku.yamahata at intel com> |
| 3 |
# <isaku.yamahata at gmail com> |
| 4 |
# All Rights Reserved. |
| 5 |
# |
| 6 |
# |
| 7 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 8 |
# not use this file except in compliance with the License. You may obtain |
| 9 |
# a copy of the License at |
| 10 |
# |
| 11 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
# |
| 13 |
# Unless required by applicable law or agreed to in writing, software |
| 14 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 |
# License for the specific language governing permissions and limitations |
| 17 |
# under the License. |
| 18 |
# |
| 19 |
|
| 20 |
import logging |
| 21 |
|
| 22 |
import testtools |
| 23 |
|
| 24 |
from neutronclient.neutron import v2_0 as neutronV20 |
| 25 |
|
| 26 |
|
| 27 |
class TestCommandMeta(testtools.TestCase): |
| 28 |
def test_neutron_command_meta_defines_log(self): |
| 29 |
class FakeCommand(neutronV20.NeutronCommand): |
| 30 |
pass |
| 31 |
|
| 32 |
self.assertTrue(hasattr(FakeCommand, 'log')) |
| 33 |
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass()) |
| 34 |
self.assertEqual(__name__ + ".FakeCommand", FakeCommand.log.name) |
| 35 |
|
| 36 |
def test_neutron_command_log_defined_explicitly(self): |
| 37 |
class FakeCommand(neutronV20.NeutronCommand): |
| 38 |
log = None |
| 39 |
|
| 40 |
self.assertTrue(hasattr(FakeCommand, 'log')) |
| 41 |
self.assertIsNone(FakeCommand.log) |