1 ##############################################################################
2 # Copyright (c) 2016 Dan Radez (Red Hat)
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 from apex.tests import constants as con
13 from apex.common import parsers as apex_parsers
14 from nose.tools import (
20 class TestCommonParsers:
23 """This method is run once for each class before any tests are run"""
26 def teardown_class(cls):
27 """This method is run once for each class _after_ all tests are run"""
30 """This method is run once before _each_ test method is executed"""
33 """This method is run once after _each_ test method is executed"""
35 def test_parse_nova_output(self):
36 output = apex_parsers.parse_nova_output(
37 os.path.join(con.TEST_DUMMY_CONFIG, 'nova_output.json'))
38 assert_is_instance(output, dict)
40 'overcloud-controller-0': '192.30.9.8',
41 'overcloud-novacompute-0': '192.30.9.10',
42 'overcloud-novacompute-1': '192.30.9.9'
45 assert_dict_equal(output, nodes)
47 def test_parse_overcloudrc(self):
48 output = apex_parsers.parse_overcloudrc(
49 os.path.join(con.TEST_DUMMY_CONFIG, 'test_overcloudrc'))
50 assert_is_instance(output, dict)
51 assert 'OS_AUTH_TYPE' in output.keys()
52 assert output['OS_AUTH_TYPE'] == 'password'
53 assert 'OS_PASSWORD' in output.keys()
54 assert output['OS_PASSWORD'] == 'Wd8ruyf6qG8cmcms6dq2HM93f'