Repository: privacyidea/privacyidea

Issue:
Remove get_QRimage_data from tokenclass.py
The function get_QRimage_data is not used anywhere.
We should remove it.


Discussion:

Resolving patch:
diff --git a/privacyidea/lib/tokenclass.py b/privacyidea/lib/tokenclass.py
--- a/privacyidea/lib/tokenclass.py
+++ b/privacyidea/lib/tokenclass.py
@@ -1298,19 +1298,6 @@ def get_init_detail(self, params=None, user=None):
 
         return response_detail
 
-    def get_QRimage_data(self, response_detail):
-        """
-        FIXME: Do we really use this?
-        """
-        url = None
-        hparam = {}
-
-        if response_detail is not None and 'googleurl' in response_detail:
-            url = response_detail.get('googleurl')
-            hparam['alt'] = url
-
-        return url, hparam
-
     # challenge interfaces starts here
     @challenge_response_allowed
     def is_challenge_request(self, passw, user=None, options=None):


Test patch:
diff --git a/tests/test_lib_tokenclass.py b/tests/test_lib_tokenclass.py
--- a/tests/test_lib_tokenclass.py
+++ b/tests/test_lib_tokenclass.py
@@ -493,8 +493,6 @@ def test_16_init_detail(self):
         self.assertTrue("otpkey" not in token.token.get_info(),
                         token.token.get_info())
 
-        token.get_QRimage_data({"googleurl": "hotp://"})
-        self.assertRaises(Exception, token.set_init_details, "unvalid value")
         token.set_init_details({"detail1": "value1"})
         self.assertTrue("detail1" in token.get_init_details(),
                         token.get_init_details())
diff --git a/tests/test_lib_tokens_daplug.py b/tests/test_lib_tokens_daplug.py
--- a/tests/test_lib_tokens_daplug.py
+++ b/tests/test_lib_tokens_daplug.py
@@ -387,12 +387,7 @@ def test_16_init_detail(self):
         self.assertTrue("img" in otpkey, otpkey)
         self.assertTrue("googleurl" in detail, detail)
         # some other stuff.
-        r = token.get_QRimage_data({"googleurl": detail.get("googleurl").get(
-            "value")})
-        self.assertEqual(r[0],
-                         'otpauth://daplug/SE123456?secret=CERDGRCVMZ3YRGIA'
-                         '&digits=6&issuer=privacyIDEA')
-        self.assertRaises(Exception, token.set_init_details, "unvalid value")
+        self.assertRaises(Exception, token.set_init_details, "invalid value")
         token.set_init_details({"detail1": "value1"})
         self.assertTrue("detail1" in token.get_init_details(),
                         token.get_init_details())
diff --git a/tests/test_lib_tokens_hotp.py b/tests/test_lib_tokens_hotp.py
--- a/tests/test_lib_tokens_hotp.py
+++ b/tests/test_lib_tokens_hotp.py
@@ -393,11 +393,7 @@ def test_16_init_detail(self):
         self.assertTrue("img" in otpkey, otpkey)
         self.assertTrue("googleurl" in detail, detail)
         # some other stuff.
-        r = token.get_QRimage_data({"googleurl": detail.get("googleurl").get(
-            "value")})
-        self.assertTrue('otpauth://hotp/SE123456?secret=CERDGRCVMZ3YRGIA'
-                        '&counter=1' in r[0], r[0])
-        self.assertRaises(Exception, token.set_init_details, "unvalid value")
+        self.assertRaises(Exception, token.set_init_details, "invalid value")
         token.set_init_details({"detail1": "value1"})
         self.assertTrue("detail1" in token.get_init_details(),
                         token.get_init_details())
diff --git a/tests/test_lib_tokens_motp.py b/tests/test_lib_tokens_motp.py
--- a/tests/test_lib_tokens_motp.py
+++ b/tests/test_lib_tokens_motp.py
@@ -129,7 +129,7 @@ def test_16_init_detail(self):
         motpurl = detail.get("motpurl").get("value")
         self.assertTrue(motpurl == 'motp://privacyidea:mylabel?'
                         'secret=11223344556677889900', motpurl)
-        self.assertRaises(Exception, token.set_init_details, "unvalid value")
+        self.assertRaises(Exception, token.set_init_details, "invalid value")
         token.set_init_details({"detail1": "value1"})
         self.assertTrue("detail1" in token.get_init_details(),
                         token.get_init_details())
diff --git a/tests/test_lib_tokens_totp.py b/tests/test_lib_tokens_totp.py
--- a/tests/test_lib_tokens_totp.py
+++ b/tests/test_lib_tokens_totp.py
@@ -347,11 +347,7 @@ def test_16_init_detail(self):
         self.assertTrue("img" in otpkey, otpkey)
         self.assertTrue("googleurl" in detail, detail)
         # some other stuff.
-        r = token.get_QRimage_data({"googleurl": detail.get("googleurl").get(
-            "value")})
-        self.assertEqual(r[0], 'otpauth://totp/SE123456?secret=CERDGRCVMZ3YRGIA'
-                         '&period=30&digits=6&issuer=privacyIDEA')
-        self.assertRaises(Exception, token.set_init_details, "unvalid value")
+        self.assertRaises(Exception, token.set_init_details, "invalid value")
         token.set_init_details({"detail1": "value1"})
         self.assertTrue("detail1" in token.get_init_details(),
                         token.get_init_details())