Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-18 Thread Martin Basti



On 18.05.2016 11:07, Peter Lacko wrote:

So last one (hopefully).

Peter


- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" 
Cc: freeipa-devel@redhat.com
Sent: Monday, May 16, 2016 6:32:49 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 13.05.2016 15:05, Peter Lacko wrote:

Desciption added back, header changed to original.

Peter

- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" 
Cc: freeipa-devel@redhat.com
Sent: Friday, May 13, 2016 2:02:00 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 13.05.2016 13:59, Peter Lacko wrote:

Hi,

Thanks again, will remember that. I also changed header to short one.

Peter

Whyyy?



- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" , freeipa-devel@redhat.com
Sent: Tuesday, May 10, 2016 12:23:13 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 28.04.2016 16:09, Martin Basti wrote:

On 08.04.2016 10:32, Peter Lacko wrote:
Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all
patches)
this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2



Sorry I didn't noticed earlier, but your patch doesn't work under python3

from xmlrpc_test import XMLRPC_test, raises_exact
E   ImportError: No module named 'xmlrpc_test'

You must use absolute import, not relative in py3

Martin^2

Sorry, NACK

* Module ipatests.test_xmlrpc.test_ping_plugin
ipatests/test_xmlrpc/test_ping_plugin.py:29: [E0611(no-name-in-module),
] No name 'test_xmplrpc' in module 'ipatests')

did you mean 'test_xmlrpc'?

Martin^2

ACK

Pushed to master: 144a367d35d0d15a732e851adffd251d04711af9

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-18 Thread Peter Lacko
So last one (hopefully).

Peter


- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" 
Cc: freeipa-devel@redhat.com
Sent: Monday, May 16, 2016 6:32:49 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 13.05.2016 15:05, Peter Lacko wrote:
> Desciption added back, header changed to original.
>
> Peter
>
> - Original Message -
> From: "Martin Basti" 
> To: "Peter Lacko" 
> Cc: freeipa-devel@redhat.com
> Sent: Friday, May 13, 2016 2:02:00 PM
> Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
> non-declarative way
>
>
>
> On 13.05.2016 13:59, Peter Lacko wrote:
>> Hi,
>>
>> Thanks again, will remember that. I also changed header to short one.
>>
>> Peter
> Whyyy?
>
>
>>
>> - Original Message -----
>> From: "Martin Basti" 
>> To: "Peter Lacko" , freeipa-devel@redhat.com
>> Sent: Tuesday, May 10, 2016 12:23:13 PM
>> Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
>> non-declarative way
>>
>>
>>
>> On 28.04.2016 16:09, Martin Basti wrote:
>>> On 08.04.2016 10:32, Peter Lacko wrote:
>>> Hello,
>>>
>>> I have a few comments:
>>>
>>> 1)
>>> Please set up your git name and email correctly (consistently for all
>>> patches)
>>> this is not right From: root
>>>
>>> 2)
>>> -# Copyright (C) 2012  Red Hat
>>> +# Copyright (C) 2016  Red Hat
>>>
>>> leave there both years please
>>> +# Copyright (C) 2012, 2016  Red Hat
>>>
>>> 3)
>>> Please put the patch number to the email subject, it is easier to find 
>>> correct patch for us
>>>
>>> Otherwise LGTM and works for me.
>>>
>>> Martin^2
>>>
>>>
>> Sorry I didn't noticed earlier, but your patch doesn't work under python3
>>
>>from xmlrpc_test import XMLRPC_test, raises_exact
>> E   ImportError: No module named 'xmlrpc_test'
>>
>> You must use absolute import, not relative in py3
>>
>> Martin^2
Sorry, NACK

* Module ipatests.test_xmlrpc.test_ping_plugin
ipatests/test_xmlrpc/test_ping_plugin.py:29: [E0611(no-name-in-module), 
] No name 'test_xmplrpc' in module 'ipatests')

did you mean 'test_xmlrpc'?

Martin^2
From b43a04b2bf9de24e07f3c9cc901c37d35329567c Mon Sep 17 00:00:00 2001
From: Peter Lacko 
Date: Fri, 13 May 2016 13:49:40 +0200
Subject: [PATCH] Ping module tests.

Test for ping module rewritten using non-declarative way.
No new functionality has been added.
---
 ipatests/test_xmlrpc/test_ping_plugin.py | 49 
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_ping_plugin.py b/ipatests/test_xmlrpc/test_ping_plugin.py
index afd34fa1482735ac802b57a5d6cd387b18574f89..2c089a9cb384082a70b1d19c1199542d43e1a062 100644
--- a/ipatests/test_xmlrpc/test_ping_plugin.py
+++ b/ipatests/test_xmlrpc/test_ping_plugin.py
@@ -1,7 +1,8 @@
 # Authors:
 #   Petr Viktorin 
+#   Peter Lacko   
 #
-# 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):
+class TestPing(XMLRPC_test):
+"""Test functionality of the `ipalib/plugins/ping.py` module."""
+tracker = Tracker()
 
-tests = [
-dict(
-desc='Ping the server',
-command=('ping', [], {}),
-expected=dict(
-summary=Fuzzy('IPA server version .*. API version .*')),
-),
+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)
 
-dict(
-desc='Try to ping with an argument',
-command=('ping', ['bad_arg'], {}),
-   

Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-16 Thread Martin Basti



On 13.05.2016 15:05, Peter Lacko wrote:

Desciption added back, header changed to original.

Peter

- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" 
Cc: freeipa-devel@redhat.com
Sent: Friday, May 13, 2016 2:02:00 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 13.05.2016 13:59, Peter Lacko wrote:

Hi,

Thanks again, will remember that. I also changed header to short one.

Peter

Whyyy?




- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" , freeipa-devel@redhat.com
Sent: Tuesday, May 10, 2016 12:23:13 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 28.04.2016 16:09, Martin Basti wrote:

On 08.04.2016 10:32, Peter Lacko wrote:
Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all
patches)
this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2



Sorry I didn't noticed earlier, but your patch doesn't work under python3

   from xmlrpc_test import XMLRPC_test, raises_exact
E   ImportError: No module named 'xmlrpc_test'

You must use absolute import, not relative in py3

Martin^2

Sorry, NACK

* Module ipatests.test_xmlrpc.test_ping_plugin
ipatests/test_xmlrpc/test_ping_plugin.py:29: [E0611(no-name-in-module), 
] No name 'test_xmplrpc' in module 'ipatests')


did you mean 'test_xmlrpc'?

Martin^2

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-13 Thread Peter Lacko
Desciption added back, header changed to original.

Peter

- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" 
Cc: freeipa-devel@redhat.com
Sent: Friday, May 13, 2016 2:02:00 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 13.05.2016 13:59, Peter Lacko wrote:
> Hi,
>
> Thanks again, will remember that. I also changed header to short one.
>
> Peter

Whyyy?


>
>
> - Original Message -
> From: "Martin Basti" 
> To: "Peter Lacko" , freeipa-devel@redhat.com
> Sent: Tuesday, May 10, 2016 12:23:13 PM
> Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
> non-declarative way
>
>
>
> On 28.04.2016 16:09, Martin Basti wrote:
>>
>> On 08.04.2016 10:32, Peter Lacko wrote:
>>>
>> Hello,
>>
>> I have a few comments:
>>
>> 1)
>> Please set up your git name and email correctly (consistently for all
>> patches)
>> this is not right From: root
>>
>> 2)
>> -# Copyright (C) 2012  Red Hat
>> +# Copyright (C) 2016  Red Hat
>>
>> leave there both years please
>> +# Copyright (C) 2012, 2016  Red Hat
>>
>> 3)
>> Please put the patch number to the email subject, it is easier to find 
>> correct patch for us
>>
>> Otherwise LGTM and works for me.
>>
>> Martin^2
>>
>>
> Sorry I didn't noticed earlier, but your patch doesn't work under python3
>
>   from xmlrpc_test import XMLRPC_test, raises_exact
> E   ImportError: No module named 'xmlrpc_test'
>
> You must use absolute import, not relative in py3
>
> Martin^2

From a10f780ada3304ddd444194ddc318a9275e32715 Mon Sep 17 00:00:00 2001
From: Peter Lacko 
Date: Fri, 13 May 2016 13:49:40 +0200
Subject: [PATCH] Ping module tests.

Tests for ping module rewritten using non-declarative way.
No new functionality has been added.
---
 ipatests/test_xmlrpc/test_ping_plugin.py | 49 
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_ping_plugin.py b/ipatests/test_xmlrpc/test_ping_plugin.py
index afd34fa1482735ac802b57a5d6cd387b18574f89..fea786093dc518f6c39496574de0e38e5d7e6c7e 100644
--- a/ipatests/test_xmlrpc/test_ping_plugin.py
+++ b/ipatests/test_xmlrpc/test_ping_plugin.py
@@ -1,7 +1,8 @@
 # Authors:
 #   Petr Viktorin 
+#   Peter Lacko   
 #
-# 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_xmplrpc.xmlrpc_test import XMLRPC_test, raises_exact
+from ipatests.util import assert_equal, Fuzzy
+
 
 @pytest.mark.tier1
-class test_ping(Declarative):
+class TestPing(XMLRPC_test):
+"""Test functionality of the `ipalib/plugins/ping.py` module."""
+tracker = Tracker()
 
-tests = [
-dict(
-desc='Ping the server',
-command=('ping', [], {}),
-expected=dict(
-summary=Fuzzy('IPA server version .*. API version .*')),
-),
+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)
 
-dict(
-desc='Try to ping with an argument',
-command=('ping', ['bad_arg'], {}),
-expected=errors.ZeroArgumentError(name='ping'),
-),
+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'])
 
-dict(
-desc='Try to ping with an option',
-command=('ping', [], dict(bad_arg=True)),
-expected=errors.OptionError(_('Unknown option: %(option)s'),
-option='bad_arg'),
-),
-
-]
+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)
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-13 Thread Martin Basti



On 13.05.2016 13:59, Peter Lacko wrote:

Hi,

Thanks again, will remember that. I also changed header to short one.

Peter


Whyyy?





- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" , freeipa-devel@redhat.com
Sent: Tuesday, May 10, 2016 12:23:13 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 28.04.2016 16:09, Martin Basti wrote:


On 08.04.2016 10:32, Peter Lacko wrote:



Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all
patches)
this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2



Sorry I didn't noticed earlier, but your patch doesn't work under python3

  from xmlrpc_test import XMLRPC_test, raises_exact
E   ImportError: No module named 'xmlrpc_test'

You must use absolute import, not relative in py3

Martin^2


--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-13 Thread Peter Lacko
Hi,

Thanks again, will remember that. I also changed header to short one.

Peter


- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" , freeipa-devel@redhat.com
Sent: Tuesday, May 10, 2016 12:23:13 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 28.04.2016 16:09, Martin Basti wrote:
>
>
> On 08.04.2016 10:32, Peter Lacko wrote:
>>
>>
>
> Hello,
>
> I have a few comments:
>
> 1)
> Please set up your git name and email correctly (consistently for all 
> patches)
> this is not right From: root
>
> 2)
> -# Copyright (C) 2012  Red Hat
> +# Copyright (C) 2016  Red Hat
>
> leave there both years please
> +# Copyright (C) 2012, 2016  Red Hat
>
> 3)
> Please put the patch number to the email subject, it is easier to find 
> correct patch for us
>
> Otherwise LGTM and works for me.
>
> Martin^2
>
>
Sorry I didn't noticed earlier, but your patch doesn't work under python3

 from xmlrpc_test import XMLRPC_test, raises_exact
E   ImportError: No module named 'xmlrpc_test'

You must use absolute import, not relative in py3

Martin^2
From 18c4b8233738d517e910fec6b53b4fb5149680a0 Mon Sep 17 00:00:00 2001
From: Peter Lacko 
Date: Fri, 13 May 2016 13:49:40 +0200
Subject: [PATCH] Ping module tests.

---
 ipatests/test_xmlrpc/test_ping_plugin.py | 63 
 1 file changed, 23 insertions(+), 40 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_ping_plugin.py b/ipatests/test_xmlrpc/test_ping_plugin.py
index afd34fa1482735ac802b57a5d6cd387b18574f89..6bb84d643331035d3b6a25a14f768dcdd2164666 100644
--- a/ipatests/test_xmlrpc/test_ping_plugin.py
+++ b/ipatests/test_xmlrpc/test_ping_plugin.py
@@ -1,54 +1,37 @@
-# Authors:
-#   Petr Viktorin 
 #
-# Copyright (C) 2012  Red Hat
-# see file 'COPYING' for use and warranty information
+# Copyright (C) 2016  FreeIPA Contributors see COPYING for license
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 """
 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):
+class TestPing(XMLRPC_test):
+"""Test functionality of the `ipalib/plugins/ping.py` module."""
+tracker = Tracker()
 
-tests = [
-dict(
-desc='Ping the server',
-command=('ping', [], {}),
-expected=dict(
-summary=Fuzzy('IPA server version .*. API version .*')),
-),
+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)
 
-dict(
-desc='Try to ping with an argument',
-command=('ping', ['bad_arg'], {}),
-expected=errors.ZeroArgumentError(name='ping'),
-),
+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'])
 
-dict(
-desc='Try to ping with an option',
-command=('ping', [], dict(bad_arg=True)),
-expected=errors.OptionError(_('Unknown option: %(option)s'),
-option='bad_arg'),
-),
-
-]
+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)
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-10 Thread Martin Basti



On 28.04.2016 16:09, Martin Basti wrote:



On 08.04.2016 10:32, Peter Lacko wrote:





Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all 
patches)

this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2



Sorry I didn't noticed earlier, but your patch doesn't work under python3

from xmlrpc_test import XMLRPC_test, raises_exact
E   ImportError: No module named 'xmlrpc_test'

You must use absolute import, not relative in py3

Martin^2
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-05-04 Thread Peter Lacko
Hi!

Thanks for the review, should be OK now. I won't change this email's subject, 
so adding it to the body only and will include it in subject of next patch.

[PATCH 0001]

Regards,

Peter Lacko


- Original Message -
From: "Martin Basti" 
To: "Peter Lacko" , freeipa-devel@redhat.com
Sent: Thursday, April 28, 2016 4:09:17 PM
Subject: Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a 
non-declarative way



On 08.04.2016 10:32, Peter Lacko wrote:
>
>

Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all 
patches)

this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2
From 79e29e40349b9ff77c89b8b7297ca1422ac2020b Mon Sep 17 00:00:00 2001
From: Peter Lacko 
Date: Wed, 4 May 2016 13:17:57 +0200
Subject: [PATCH] Ping module tests.

Test for ping module rewritten using non-declarative way.
No new functionality has been added.
---
 ipatests/test_xmlrpc/test_ping_plugin.py | 49 
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_ping_plugin.py b/ipatests/test_xmlrpc/test_ping_plugin.py
index afd34fa1482735ac802b57a5d6cd387b18574f89..8f1ee714340bef0614757d8c7a318f7642563585 100644
--- a/ipatests/test_xmlrpc/test_ping_plugin.py
+++ b/ipatests/test_xmlrpc/test_ping_plugin.py
@@ -1,7 +1,8 @@
 # Authors:
 #   Petr Viktorin 
+#   Peter Lacko   
 #
-# 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.util import assert_equal, Fuzzy
+from xmlrpc_test import XMLRPC_test, raises_exact
+
 
 @pytest.mark.tier1
-class test_ping(Declarative):
+class TestPing(XMLRPC_test):
+"""Test functionality of the `ipalib/plugins/ping.py` module."""
+tracker = Tracker()
 
-tests = [
-dict(
-desc='Ping the server',
-command=('ping', [], {}),
-expected=dict(
-summary=Fuzzy('IPA server version .*. API version .*')),
-),
+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)
 
-dict(
-desc='Try to ping with an argument',
-command=('ping', ['bad_arg'], {}),
-expected=errors.ZeroArgumentError(name='ping'),
-),
+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'])
 
-dict(
-desc='Try to ping with an option',
-command=('ping', [], dict(bad_arg=True)),
-expected=errors.OptionError(_('Unknown option: %(option)s'),
-option='bad_arg'),
-),
-
-]
+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)
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [TESTS][PATCH] Ping module tests in a non-declarative way

2016-04-28 Thread Martin Basti



On 08.04.2016 10:32, Peter Lacko wrote:





Hello,

I have a few comments:

1)
Please set up your git name and email correctly (consistently for all 
patches)


this is not right From: root

2)
-# Copyright (C) 2012  Red Hat
+# Copyright (C) 2016  Red Hat

leave there both years please
+# Copyright (C) 2012, 2016  Red Hat

3)
Please put the patch number to the email subject, it is easier to find correct 
patch for us

Otherwise LGTM and works for me.

Martin^2
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code