Update openstack refs to opendev
[apex.git] / apex / tests / test_apex_deployment_tripleo.py
1 ##############################################################################
2 # Copyright (c) 2018 Tim Rozet (trozet@redhat.com) (Red Hat)
3 #
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 ##############################################################################
9
10 import os
11 import unittest
12
13 from apex.deployment.tripleo import ApexDeployment
14 from apex.settings.deploy_settings import DeploySettings
15 from apex.tests.constants import TEST_DUMMY_CONFIG
16
17
18 class TestApexDeployment(unittest.TestCase):
19     @classmethod
20     def setup_class(cls):
21         """This method is run once for each class before any tests are run"""
22
23     @classmethod
24     def teardown_class(cls):
25         """This method is run once for each class _after_ all tests are run"""
26
27     def setup(self):
28         """This method is run once before _each_ test method is executed"""
29
30     def teardown(self):
31         """This method is run once after _each_ test method is executed"""
32
33     def test_determine_patches(self):
34         self.maxDiff = None
35         ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
36         ds = DeploySettings(ds_file)
37         patches_file = os.path.join(TEST_DUMMY_CONFIG, 'common-patches.yaml')
38         d = ApexDeployment(deploy_settings=ds, patch_file=patches_file,
39                            ds_file=ds_file)
40         patches = d.determine_patches()
41         test_patches = {
42             'undercloud':
43                 [{'change-id': 'I2e0a40d7902f592e4b7bd727f57048111e0bea36',
44                   'project': 'openstack/tripleo-common'}],
45             'overcloud':
46                 [{'change-id': 'Ie988ba6a2d444a614e97c0edf5fce24b23970310',
47                   'project': 'openstack/puppet-tripleo'}]
48         }
49         self.assertDictEqual(patches, test_patches)