~jcsackett/charmworld/bac-tag-constraints

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
# Copyright 2013 Canonical Ltd.  This software is licensed under the GNU
# Affero General Public License version 3 (see the file LICENSE).

from copy import deepcopy
from textwrap import dedent

import yaml

from charmworld.lib.deployer import get_flattened_deployment
from charmworld.testing import TestCase


class TestDeployerIntegration(TestCase):

    def test_deployer_integration(self):
        deployer_config = dedent("""\
            wordpress-stage:
                series: precise
                services:
                    blog:
                        charm: cs:precise/wordpress
                        constraints: mem=2
                        options:
                            tuning: optimized
                            engine: apache
        """)
        parsed = yaml.safe_load(deployer_config)
        expected = deepcopy(parsed)['wordpress-stage']
        result = get_flattened_deployment(parsed, 'wordpress-stage')
        self.assertEqual(expected, result)