~marcoceppi/charm-tools/patch-generate-path

« back to all changes in this revision

Viewing changes to tests/test_config.py

  • Committer: Tim Van Steenburgh
  • Date: 2015-08-31 20:23:05 UTC
  • mfrom: (354.2.28 compose)
  • Revision ID: tim.van.steenburgh@canonical.com-20150831202305-6z5ra37q0atmq92b
[bcsaller] Add charm composer and port tests to tox.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import logging
 
2
import unittest
 
3
 
 
4
from charmtools.compose.config import ComposerConfig
 
5
 
 
6
 
 
7
class TestConfig(unittest.TestCase):
 
8
    def test_rget(self):
 
9
        c = ComposerConfig()
 
10
        c['a'] = 1
 
11
        c = c.new_child()
 
12
        c['a'] = 99
 
13
        c['b'] = "alpha"
 
14
        self.assertEqual(c.get('a'), 99)
 
15
        self.assertEqual(c.get('b'), "alpha")
 
16
        self.assertEqual(c.rget('a'), [99, 1])
 
17
 
 
18
    def test_tactics(self):
 
19
        # configure from empty and a layer with tactics
 
20
        c = ComposerConfig()
 
21
        c._tactics = ['a', 'b', 'c']
 
22
        c = c.new_child()
 
23
        c._tactics = ['d', 'c']
 
24
        self.assertEqual(c.tactics()[:5], ['d', 'c', 'a', 'b', 'c'])
 
25
 
 
26
 
 
27
if __name__ == '__main__':
 
28
    logging.basicConfig()
 
29
    unittest.main()