From: Alfredo Deza Date: Wed, 4 Jun 2014 20:37:48 +0000 (-0400) Subject: unit tests for the new templating changes X-Git-Tag: v1.5.4~4^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52eca880cf10b92632932a0dd47a5c1d8266c6cd;p=ceph-deploy.git unit tests for the new templating changes Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/tests/unit/util/test_templates.py b/ceph_deploy/tests/unit/util/test_templates.py new file mode 100644 index 0000000..36c39cd --- /dev/null +++ b/ceph_deploy/tests/unit/util/test_templates.py @@ -0,0 +1,29 @@ +from textwrap import dedent +from ceph_deploy.util import templates + + +class TestCustomRepo(object): + + def test_only_repo_name(self): + result = templates.custom_repo(reponame='foo') + assert result == '[foo]' + + def test_second_line_with_good_value(self): + result = templates.custom_repo(reponame='foo', enabled=0) + assert result == '[foo]\nenabled=0' + + def test_mixed_values(self): + result = templates.custom_repo( + reponame='foo', + enabled=0, + gpgcheck=1, + baseurl='example.org') + assert result == dedent("""\ + [foo] + baseurl=example.org + enabled=0 + gpgcheck=1""") + + def test_allow_invalid_options(self): + result = templates.custom_repo(reponame='foo', bar='bar') + assert result == '[foo]'