diff options
author | Peter Lacko <placko@redhat.com> | 2016-05-13 13:49:40 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-05-18 17:19:05 +0200 |
commit | 144a367d35d0d15a732e851adffd251d04711af9 (patch) | |
tree | e7955588f1ede648e30360a7ef2d1f0fc0a17d40 /ipatests/test_xmlrpc/test_ping_plugin.py | |
parent | 89cdf6ee1e796e5ba4c302a19da4862e18b99c4a (diff) | |
download | freeipa-144a367d35d0d15a732e851adffd251d04711af9.tar.gz freeipa-144a367d35d0d15a732e851adffd251d04711af9.tar.xz freeipa-144a367d35d0d15a732e851adffd251d04711af9.zip |
Ping module tests.
Test for ping module rewritten using non-declarative way.
No new functionality has been added.
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc/test_ping_plugin.py')
-rw-r--r-- | ipatests/test_xmlrpc/test_ping_plugin.py | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/ipatests/test_xmlrpc/test_ping_plugin.py b/ipatests/test_xmlrpc/test_ping_plugin.py index afd34fa14..2c089a9cb 100644 --- a/ipatests/test_xmlrpc/test_ping_plugin.py +++ b/ipatests/test_xmlrpc/test_ping_plugin.py @@ -1,7 +1,8 @@ # Authors: # Petr Viktorin <pviktori@redhat.com> +# Peter Lacko <placko@redhat.com> # -# Copyright (C) 2012 Red Hat +# Copyright (C) 2012, 2016 Red Hat # see file 'COPYING' for use and warranty information # # This program is free software; you can redistribute it and/or modify @@ -21,34 +22,32 @@ Test the `ipalib/plugins/ping.py` module, and XML-RPC in general. """ -from ipalib import errors, _ -from ipatests.util import Fuzzy -from ipatests.test_xmlrpc.xmlrpc_test import Declarative import pytest +from ipalib import errors, _ +from ipatests.test_xmlrpc.tracker.base import Tracker +from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, raises_exact +from ipatests.util import assert_equal, Fuzzy + @pytest.mark.tier1 -class test_ping(Declarative): - - tests = [ - dict( - desc='Ping the server', - command=('ping', [], {}), - expected=dict( - summary=Fuzzy('IPA server version .*. API version .*')), - ), - - dict( - desc='Try to ping with an argument', - command=('ping', ['bad_arg'], {}), - expected=errors.ZeroArgumentError(name='ping'), - ), - - dict( - desc='Try to ping with an option', - command=('ping', [], dict(bad_arg=True)), - expected=errors.OptionError(_('Unknown option: %(option)s'), - option='bad_arg'), - ), - - ] +class TestPing(XMLRPC_test): + """Test functionality of the `ipalib/plugins/ping.py` module.""" + tracker = Tracker() + + def test_ping(self): + """Ping the server.""" + result = self.tracker.run_command('ping') + exp = {'summary': Fuzzy('IPA server version .*. API version .*')} + assert_equal(result, exp) + + def test_ping_with_argument(self): + """Try to ping with an argument.""" + with raises_exact(errors.ZeroArgumentError(name='ping')): + self.tracker.run_command('ping', ['argument']) + + def test_ping_with_option(self): + """Try to ping with an option.""" + with raises_exact(errors.OptionError( + _('Unknown option: %(option)s'), option='bad_arg')): + self.tracker.run_command('ping', bad_arg=True) |