# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from automationclient.tests import utils from automationclient.tests.v1_1 import fakes from automationclient.v1_1.zones import Zone from automationclient.v1_1.nodes import Node from automationclient.v1_1.tasks import Task cs = fakes.FakeClient() class NodeTest(utils.TestCase): def test_node_list(self): zone = cs.zones.get(1234) cs.assert_called('GET', '/zones/1234') self.assertIsInstance(zone, Zone) nodes = cs.nodes.list(zone) cs.assert_called('GET', '/zones/1234/nodes') self.assertEqual(len(nodes), 2) [self.assertTrue(isinstance(node, Node)) for node in nodes] def test_node_show(self): zone = cs.zones.get(1234)
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from automationclient import extension from automationclient.v1_1.contrib import list_extensions from automationclient.tests import utils from automationclient.tests.v1_1 import fakes extensions = [ extension.Extension(list_extensions.__name__.split(".")[-1], list_extensions), ] cs = fakes.FakeClient(extensions=extensions) class ListExtensionsTests(utils.TestCase): ''' def test_list_extensions(self): all_exts = cs.list_extensions.show_all() cs.assert_called('GET', '/extensions') self.assertTrue(len(all_exts) > 0) for r in all_exts: self.assertTrue(len(r.summary) > 0) '''