Skip to content

Commit

Permalink
Refactored test_utils #26
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Nov 2, 2015
1 parent ab0678d commit d71a72c
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,41 @@ class TestUtils(unittest.TestCase):
tests for netjsonconfig.utils
"""
def test_merge_config(self):
template = {"a": "a", "c": "template"}
config = {"b": "b", "c": "config"}
result = merge_config(template, config)
self.assertEqual(result, {
"a": "a",
"b": "b",
"c": "config"
})

def test_merge_config_dict(self):
template = {
"dict": {
"a": "a"
},
"list": [
"element1"
]
"dict": {"a": "a"},
}
config = {
"dict": {
"b": "b"
},
"list": [
"element2"
]
"dict": {"b": "b"},
"key": "val"
}
result = merge_config(template, config)
self.assertEqual(result, {
"dict": {
"a": "a",
"b": "b"
},
"key": "val"
})

def test_merge_config_list(self):
template = {
"list": ["element1"]
}
config = {
"list": ["element2"]
}
result = merge_config(template, config)
self.assertEqual(result, {
"list": [
"element1",
"element2"
Expand Down

0 comments on commit d71a72c

Please sign in to comment.