File: test_objset.py

package info (click to toggle)
crmsh 5.0.0~rc1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,752 kB
  • sloc: python: 50,224; sh: 1,204; makefile: 254; xml: 243; exp: 234; awk: 22
file content (40 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from __future__ import unicode_literals
# Copyright (C) 2014 Kristoffer Gronlund <kgronlund@suse.com>
# See COPYING for license information.


from crmsh import cibconfig

factory = cibconfig.cib_factory


def assert_in(needle, haystack):
    if needle not in haystack:
        message = "%s not in %s" % (needle, haystack)
        raise AssertionError(message)


def setup_function():
    "set up test fixtures"
    from crmsh import idmgmt
    idmgmt.clear()


def teardown_function():
    pass


def test_nodes_nocli():
    for n in factory.node_id_list():
        obj = factory.find_object(n)
        if obj is not None:
            assert obj.node is not None
            assert True == obj.cli_use_validate()
            assert False == obj.nocli


def test_show():
    setobj = cibconfig.mkset_obj()
    s = setobj.repr_nopretty()
    sp = s.splitlines()
    assert_in("node ha-one", sp[0:3])