~rbanffy/+junk/python3-seamicroclient

« back to all changes in this revision

Viewing changes to python-seamicroclient-0.2.1/seamicroclient/tests/functional/v2/test_pools.py

  • Committer: Ricardo Bánffy
  • Date: 2015-12-15 21:36:41 UTC
  • Revision ID: rbanffy@gmail.com-20151215213641-l6rxowkaerz02467
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
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
import uuid
 
15
 
 
16
from seamicroclient.tests import utils
 
17
from seamicroclient.v2 import Client
 
18
 
 
19
 
 
20
cs = Client("admin", "seamicro", "http://chassis/v2.0")
 
21
 
 
22
 
 
23
class PoolsTest(utils.TestCase):
 
24
 
 
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)
 
29
 
 
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))
 
36
 
 
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)
 
43
 
 
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)