1
# -*- coding: utf-8 -*-
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
7
# http://www.apache.org/licenses/LICENSE-2.0
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
16
from seamicroclient.tests import utils
17
from seamicroclient.v2 import Client
20
cs = Client("admin", "seamicro", "http://chassis/v2.0")
23
class PoolsTest(utils.TestCase):
25
def test_list_pool(self):
26
self.skipTest('Test requires actual hardware, skipping...')
27
pool_list = cs.pools.list()
28
self.assertTrue(len(pool_list) > 0)
30
def test_list_pool_with_filter(self):
31
self.skipTest('Test requires actual hardware, skipping...')
32
filters = {'id': 'p6-'}
33
for pool in cs.pools.list(filters):
34
for k, v in filters.iteritems():
35
self.assertIn(v, getattr(pool, k))
37
def test_list_pool_with_filter_no_match(self):
38
self.skipTest('Test requires actual hardware, skipping...')
39
filters = {'id': str(uuid.uuid4())}
40
for pool in cs.pools.list(filters):
41
for k, v in filters.iteritems():
42
self.assertNotIn(getattr(pool, k), v)
44
def test_get_pool(self):
45
self.skipTest('Test requires actual hardware, skipping...')
46
pool_id = cs.pools.list()[0].id
47
pool = cs.pools.get(pool_id)
48
self.assertEqual(pool.id, pool_id)