URL: https://github.com/freeipa/freeipa/pull/2306
Author: mrizwan93
 Title: #2306: Test package installation suggetion being prompt
Action: opened

PR body:
"""
In order to work with IPA and Yubikey, libyubikey is required.
Before the fix, if yubikey added without having packages, it used to
result in traceback. Now it prompt error suggeting to install
'libyubikey' and 'libusb' packages.

related ticket : https://pagure.io/freeipa/issue/6979

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/2306/head:pr2306
git checkout pr2306
From e70a47b74604be098e8b1d23b1e317411fe9634c Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan Yusuf <myu...@redhat.com>
Date: Thu, 30 Aug 2018 16:07:33 +0530
Subject: [PATCH] Test package installation suggetion being prompt

In order to work with IPA and Yubikey, libyubikey is required.
Before the fix, if yubikey added without having packages, it used to
result in traceback. Now it prompt error suggeting to install
'libyubikey' and 'libusb' packages.

related ticket : https://pagure.io/freeipa/issue/6979

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
---
 .../test_integration/test_installation.py     | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index a3be80aa4e..5332e1e814 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -398,6 +398,28 @@ def test_WSGI_worker_process(self):
         wsgi_count = cmd.stdout_text.count('wsgi:ipa')
         assert constants.WSGI_PROCESSES == wsgi_count
 
+    def test_suggetion_for_yubikey_package_instal(self):
+        """ Test package installation suggetion being prompt
+
+        In order to work with IPA and Yubikey, libyubikey is required.
+        Before the fix, if yubikey added without having packages, it used to
+        result in traceback. Now it prompt error suggeting to install
+        'libyubikey' and 'libusb' packages.
+
+        related ticket : https://pagure.io/freeipa/issue/6979
+        """
+        args = ['ipa', 'user-add', 'testuser',
+                '--first', 'test', '--last', 'user']
+        self.master.run_command(args)
+
+        # try to add yubikey to the user
+        args = ['ipa', 'otptoken-add-yubikey', '--owner=testuser']
+        cmd = self.master.run_command(args, raiseonerr=False)
+        assert cmd.returncode != 0
+        exp_str = ("ipa: ERROR: No backend available. Please install"
+                   "'libyubikey' and 'libusb' packages first.")
+        assert exp_str in cmd.stderr_text
+
 
 class TestInstallMasterKRA(IntegrationTest):
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to