Repository: laterpay/laterpay-client-python

Issue:
Actually remove deprecated code
We raise a couple of deprecation warnings for a long time now. We should actually clean up the code base and get rid of those function.


Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/8342487/badge)](https://coveralls.io/builds/8342487)

Coverage increased (+0.5%) to 97.285% when pulling **4c62c987296b09ad5a637f32fa245ccbe67e03e3 on feature/remove-deprecation** into **a4738be03b9cc0680d24466b7eefe5fdde6b7d2d on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8623418/badge)](https://coveralls.io/builds/8623418)

Coverage increased (+0.5%) to 97.285% when pulling **a57e5e326075d000775e74d51cfad2d885020032 on feature/remove-deprecation** into **a4738be03b9cc0680d24466b7eefe5fdde6b7d2d on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8743835/badge)](https://coveralls.io/builds/8743835)

Coverage increased (+0.5%) to 97.285% when pulling **992f34dd28f22e9da3f3fe77636e9ea94e7b76ad on feature/remove-deprecation** into **e2863d34ea369cd4a11ae624014724cda6bae04a on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8747170/badge)](https://coveralls.io/builds/8747170)

Coverage increased (+0.5%) to 97.285% when pulling **4d4bbb201bdc9cf9d85397b004f0398d66b70dea on feature/remove-deprecation** into **e2863d34ea369cd4a11ae624014724cda6bae04a on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8747170/badge)](https://coveralls.io/builds/8747170)

Coverage increased (+0.5%) to 97.285% when pulling **4d4bbb201bdc9cf9d85397b004f0398d66b70dea on feature/remove-deprecation** into **e2863d34ea369cd4a11ae624014724cda6bae04a on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8747170/badge)](https://coveralls.io/builds/8747170)

Coverage increased (+0.5%) to 97.285% when pulling **4d4bbb201bdc9cf9d85397b004f0398d66b70dea on feature/remove-deprecation** into **e2863d34ea369cd4a11ae624014724cda6bae04a on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8747403/badge)](https://coveralls.io/builds/8747403)

Coverage increased (+0.5%) to 97.285% when pulling **d0cc11830027acca25b9bff8ca4867ad7aa23d2d on feature/remove-deprecation** into **67ebeb9dac24e5fe59d65ca4986c97aa38cfe6b4 on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8809919/badge)](https://coveralls.io/builds/8809919)

Coverage increased (+0.5%) to 97.285% when pulling **3801fb17a5cc69742cd935b7d2db4f3a3ba51ecd on feature/remove-deprecation** into **67ebeb9dac24e5fe59d65ca4986c97aa38cfe6b4 on develop**.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee7351b..55bab53 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,30 @@
 # Changelog
 
+## 5.0.0 (under development)
+
+* Removed the following long deprecated methods from the
+  `laterpay.LaterPayClient`:
+
+  * `get_access()`, use `get_access_data()` instead
+  * `get_iframeapi_balance_url()`, us `get_controls_balance_url()` instead
+  * `get_iframeapi_links_url()`, us `get_controls_links_url()` instead
+  * `get_identify_url()` is not needed following our modern access control
+    checks
+
+* Removed the following deprecated arguments from `laterpay.LaterPayClient`
+  methods:
+
+  * `use_dialog_api` from `get_login_dialog_url()`
+  * `use_dialog_api` from `get_signup_dialog_url()`
+  * `use_dialog_api` from `get_logout_dialog_url()`
+
+* Removed the following public methods from `laterpay.signing`:
+
+  * `sign_and_encode()` in favor of `laterpay.utils.signed_query()`
+  * `sign_get_url()` in favor of `laterpay.utils.signed_url()`
+
+* Removed the deprecated `cp` argument from `laterpay.ItemDefinition`
+
 
 ## 4.6.0
 
diff --git a/laterpay/__init__.py b/laterpay/__init__.py
index 458c82b..c3bbbf8 100644
--- a/laterpay/__init__.py
+++ b/laterpay/__init__.py
@@ -9,20 +9,17 @@ http://docs.laterpay.net/
 
 from __future__ import absolute_import, print_function
 
-import json
 import logging
 import pkg_resources
 import random
 import re
 import string
 import time
-import warnings
 
 import requests
 
 import six
 from six.moves.urllib.parse import quote_plus
-from six.moves.urllib.request import Request, urlopen
 
 from . import signing, utils
 
@@ -64,7 +61,7 @@ class ItemDefinition(object):
     For Single item purchases: http://docs.laterpay.net/platform/dialogs/buy/
     """
 
-    def __init__(self, item_id, pricing, url, title, cp=None, expiry=None):
+    def __init__(self, item_id, pricing, url, title, expiry=None):
 
         for price in pricing.split(','):
             if not re.match('[A-Z]{3}\d+', price):
@@ -74,9 +71,6 @@ class ItemDefinition(object):
             raise InvalidItemDefinition("Invalid expiry value %s, it should be '+3600' or UTC-based "
                                         "epoch timestamp in seconds of type int" % expiry)
 
-        if cp is not None:  # pragma: no cover
-            warnings.warn("ItemDefinition's cp parameter is deprecated and will be ignored.", DeprecationWarning)
-
         self.data = {
             'article_id': item_id,
             'pricing': pricing,
@@ -126,43 +120,6 @@ class LaterPayClient(object):
         }
         return utils.signed_url(self.shared_secret, data, url, method='GET')
 
-    def get_identify_url(self, identify_callback=None):  # pragma: no cover
-        """
-        Deprecated.
-        """
-        warnings.warn(
-            "LaterPayClient.get_identify_url() is deprecated "
-            "and will be removed in a future release.",
-            DeprecationWarning,
-        )
-
-        base_url = self._identify_url
-        data = {'cp': self.cp_key}
-
-        if identify_callback is not None:
-            data['callback_url'] = identify_callback
-
-        params = self._sign_and_encode(data, url=base_url, method="GET")
-        url = '%s?%s' % (base_url, params)
-
-        return url
-
-    def get_iframeapi_links_url(self,
-                                next_url,
-                                css_url=None,
-                                forcelang=None,
-                                show_greeting=False,
-                                show_long_greeting=False,
-                                show_login=False,
-                                show_signup=False,
-                                show_long_signup=False,
-                                use_jsevents=False):  # pragma: no cover
-        """Deprecated, see get_controls_links_url."""
-        warnings.warn("get_iframe_links_url is deprecated. Please use get_controls_links_url. "
-                      "It will be removed on a future release.", DeprecationWarning)
-        return self.get_controls_links_url(next_url, css_url, forcelang, show_greeting, show_long_greeting,
-                                           show_login, show_signup, show_long_signup, use_jsevents)
-
     def get_controls_links_url(self,
                                next_url,
                                css_url=None,
@@ -203,12 +160,6 @@ class LaterPayClient(object):
 
         return utils.signed_url(self.shared_secret, data, url, method='GET')
 
-    def get_iframeapi_balance_url(self, forcelang=None):  # pragma: no cover
-        """Deprecated, see get_controls_balance_url."""
-        warnings.warn("get_iframe_balance_url is deprecated. Please use get_controls_balance_url. "
-                      "It will be removed on a future release.", DeprecationWarning)
-        return self.get_controls_balance_url(forcelang)
-
     def get_controls_balance_url(self, forcelang=None):
         """
         Get the URL for an iframe showing the user's invoice balance.
@@ -224,63 +175,40 @@ class LaterPayClient(object):
 
         return utils.signed_url(self.shared_secret, data, base_url, method='GET')
 
-    def _get_dialog_api_url(self, url):
-        return '%s/dialog-api?url=%s' % (self.web_root, quote_plus(url))
-
-    def get_login_dialog_url(self, next_url, use_jsevents=False, use_dialog_api=True):
+    def get_login_dialog_url(self, next_url, use_jsevents=False):
         """Get the URL for a login page."""
-        url = '%s/account/dialog/login?next=%s%s%s' % (self.web_root, quote_plus(next_url),
-                                                       "&jsevents=1" if use_jsevents else "",
-                                                       "&cp=%s" % self.cp_key)
-        if use_dialog_api:
-            warnings.warn("The Dialog API Wrapper is deprecated and no longer recommended. "
-                          "Please set use_dialog_api to False when calling get_login_dialog_url. "
-                          "Future releases will not use the Dialog API Wrapper by default. "
-                          "See http://docs.laterpay.net/platform/dialogs/third_party_cookies/",
-                          DeprecationWarning)
-            return self._get_dialog_api_url(url)
+        url = '%s/account/dialog/login?next=%s%s%s' % (
+            self.web_root,
+            quote_plus(next_url),
+            "&jsevents=1" if use_jsevents else "",
+            "&cp=%s" % self.cp_key,
+        )
         return url
 
-    def get_signup_dialog_url(self, next_url, use_jsevents=False, use_dialog_api=True):
+    def get_signup_dialog_url(self, next_url, use_jsevents=False):
         """Get the URL for a signup page."""
-        url = '%s/account/dialog/signup?next=%s%s%s' % (self.web_root, quote_plus(next_url),
-                                                        "&jsevents=1" if use_jsevents else "",
-                                                        "&cp=%s" % self.cp_key)
-        if use_dialog_api:
-            warnings.warn("The Dialog API Wrapper is deprecated and no longer recommended. "
-                          "Please set use_dialog_api to False when calling get_signup_dialog_url. "
-                          "Future releases will not use the Dialog API Wrapper by default. "
-                          "See http://docs.laterpay.net/platform/dialogs/third_party_cookies/",
-                          DeprecationWarning)
-            return self._get_dialog_api_url(url)
+        url = '%s/account/dialog/signup?next=%s%s%s' % (
+            self.web_root,
+            quote_plus(next_url),
+            "&jsevents=1" if use_jsevents else "",
+            "&cp=%s" % self.cp_key,
+        )
         return url
 
-    def get_logout_dialog_url(self, next_url, use_jsevents=False, use_dialog_api=True):
+    def get_logout_dialog_url(self, next_url, use_jsevents=False):
         """Get the URL for a logout page."""
-        url = '%s/account/dialog/logout?next=%s%s%s' % (self.web_root, quote_plus(next_url),
-                                                        "&jsevents=1" if use_jsevents else "",
-                                                        "&cp=%s" % self.cp_key)
-        if use_dialog_api:
-            warnings.warn("The Dialog API Wrapper is deprecated and no longer recommended. "
-                          "Please set use_dialog_api to False when calling get_logout_dialog_url. "
-                          "Future releases will not use the Dialog API Wrapper by default. "
-                          "See http://docs.laterpay.net/platform/dialogs/third_party_cookies/",
-                          DeprecationWarning)
-            return self._get_dialog_api_url(url)
+        url = '%s/account/dialog/logout?next=%s%s%s' % (
+            self.web_root,
+            quote_plus(next_url),
+            "&jsevents=1" if use_jsevents else "",
+            "&cp=%s" % self.cp_key,
+        )
         return url
 
     @property
     def _access_url(self):
         return '%s/access' % self.api_root
 
-    @property
-    def _add_url(self):
-        return '%s/add' % self.api_root
-
-    @property
-    def _identify_url(self):
-        return '%s/identify' % self.api_root
-
     @property
     def _gettoken_url(self):
         return '%s/gettoken' % self.api_root
@@ -291,12 +219,10 @@ class LaterPayClient(object):
                      product_key=None,
                      dialog=True,
                      use_jsevents=False,
-                     skip_add_to_invoice=False,
                      transaction_reference=None,
                      consumable=False,
                      return_url=None,
                      failure_url=None,
-                     use_dialog_api=True,
                      **kwargs):
 
         # filter out params with None value.
@@ -322,10 +248,6 @@ class LaterPayClient(object):
 
             data['tref'] = transaction_reference
 
-        if skip_add_to_invoice:
-            warnings.warn('The param skip_add_to_invoice is deprecated and it '
-                          'will be removed in a future release.', DeprecationWarning)
-
         if dialog:
             prefix = '%s/%s' % (self.web_root, 'dialog')
         else:
@@ -338,16 +260,7 @@ class LaterPayClient(object):
 
         data.update(kwargs)
 
-        url = utils.signed_url(self.shared_secret, data, base_url, method='GET')
-
-        if use_dialog_api:
-            warnings.warn("The Dialog API Wrapper is deprecated and no longer recommended. "
-                          "Please set use_dialog_api to False when calling get_buy_url or get_add_url. "
-                          "Future releases will not use the Dialog API Wrapper by default. "
-                          "See http://docs.laterpay.net/platform/dialogs/third_party_cookies/",
-                          DeprecationWarning)
-            return self._get_dialog_api_url(url)
-        return url
+        return utils.signed_url(self.shared_secret, data, base_url, method='GET')
 
     def get_buy_url(self,
                     item_definition,
@@ -359,7 +272,6 @@ class LaterPayClient(object):
                     consumable=False,
                     return_url=None,
                     failure_url=None,
-                    use_dialog_api=True,
                     **kwargs):
         """
         Get the URL at which a user can start the checkout process to buy a single item.
@@ -377,7 +289,6 @@ class LaterPayClient(object):
             consumable=consumable,
             return_url=return_url,
             failure_url=failure_url,
-            use_dialog_api=use_dialog_api,
             **kwargs)
 
     def get_add_url(self,
@@ -390,7 +301,6 @@ class LaterPayClient(object):
                     consumable=False,
                     return_url=None,
                     failure_url=None,
-                    use_dialog_api=True,
                     **kwargs):
         """
         Get the URL at which a user can add an item to their invoice to pay later.
@@ -408,50 +318,8 @@ class LaterPayClient(object):
             consumable=consumable,
             return_url=return_url,
             failure_url=failure_url,
-            use_dialog_api=use_dialog_api,
             **kwargs)
 
-    def _sign_and_encode(self, params, url, method="GET"):
-        return utils.signed_query(self.shared_secret, params, url=url, method=method)
-
-    def _make_request(self, url, params, method='GET'):  # pragma: no cover
-        """
-        Deprecated.
-
-        Used by deprecated ``get_access()`` only.
-        """
-        params = self._sign_and_encode(params=params, url=url, method=method)
-
-        headers = self.get_request_headers()
-
-        if method == 'POST':
-            req = Request(url, data=params, headers=headers)
-        else:
-            url = "%s?%s" % (url, params)
-            req = Request(url, headers=headers)
-
-        _logger.debug("Making request to %s", url)
-
-        try:
-            response = urlopen(req, timeout=self.timeout_seconds).read()
-        except:
-            # TODO: Add proper or no exception handling.
-            # Pretending there was a response even if there was none
-            # (can't connect / timeout) seems like a wrong idea.
-            _logger.exception("Unexpected error with request")
-            resp = {'status': 'unexpected error'}
-        else:
-            _logger.debug("Received response %s", response)
-            resp = json.loads(response.decode())
-
-        if 'new_token' in resp:
-            self.lptoken = resp['new_token']
-
-        if resp.get('status', None) == 'invalid_token':
-            self.lptoken = None
-
-        return resp
-
     def has_token(self):
         """
         Do we have an identifier token.
@@ -460,42 +328,6 @@ class LaterPayClient(object):
         """
         return self.lptoken is not None
 
-    def get_access(self, article_ids, product_key=None):  # pragma: no cover
-        """
-        Deprecated. Consider using ``.get_access_data()`` instead.
-
-        Get access data for a set of article ids.
-
-        http://docs.laterpay.net/platform/access/access/
-        """
-        warnings.warn(
-            "LaterPayClient.get_access() is deprecated "
-            "and will be removed in a future release. "
-            "Consider using ``.get_access_data()`` instead.",
-            DeprecationWarning,
-        )
-
-        if not isinstance(article_ids, (list, tuple)):
-            article_ids = [article_ids]
-
-        params = {
-            'lptoken': self.lptoken,
-            'cp': self.cp_key,
-            'article_id': article_ids
-        }
-
-        if product_key is not None:
-            params['product'] = product_key
-
-        data = self._make_request(self._access_url, params)
-
-        allowed_statuses = ['ok', 'invalid_token', 'connection_error']
-
-        if data['status'] not in allowed_statuses:
-            raise Exception(data['status'])
-
-        return data
-
     def get_request_headers(self):
         """
         Return a ``dict`` of request headers to be sent to the API.
diff --git a/laterpay/signing.py b/laterpay/signing.py
index 347aa31..46875b8 100644
--- a/laterpay/signing.py
+++ b/laterpay/signing.py
@@ -3,11 +3,9 @@ from __future__ import absolute_import, print_function
 
 import hashlib
 import hmac
-import time
-import warnings
 
 import six
-from six.moves.urllib.parse import parse_qsl, quote, urlencode, urlparse
+from six.moves.urllib.parse import quote, urlparse
 
 from . import compat
 
@@ -190,99 +188,3 @@ def verify(signature, secret, params, url, method):
     mac = sign(secret, params, url, method)
 
     return time_independent_HMAC_compare(signature, mac)
-
-
-def sign_and_encode(secret, params, url, method="GET"):  # pragma: no cover
-    """
-    Deprecated. Consider using ``laterpay.utils.signed_query()`` instead.
-
-    Sign and encode a URL ``url`` with a ``secret`` key called via an HTTP ``method``.
-
-    It adds the signature to the URL
-    as the URL parameter "hmac" and also adds the required timestamp parameter "ts" if it's not already
-    in the ``params`` dictionary. ``unicode()`` instances in params are handled correctly.
-
-    :param secret: The shared secret as a hex-encoded string
-    :param params: A dictionary of URL parameters. Each key can resolve to a
-                   single value string or a multi-string list.
-    :param url: The URL being called
-    :param method: An uppercase string representation of the HTTP method being
-                   used for the call (e.g. "GET", "POST")
-    :return: A signed and correctly encoded URL
-    """
-    warnings.warn(
-        "sign_and_encode is deprecated. It will be removed in a future release. "
-        "Consider using ``laterpay.utils.signed_query()`` instead.",
-        DeprecationWarning,
-    )
-
-    if 'ts' not in params:
-        params['ts'] = str(int(time.time()))
-
-    if 'hmac' in params:
-        params.pop('hmac')
-
-    sorted_data = []
-    for k, v in sort_params(params):
-        k = compat.encode_if_unicode(k)
-        value = compat.encode_if_unicode(v)
-        sorted_data.append((k, value))
-
-    encoded = urlencode(sorted_data)
-    hmac = sign(secret, params, url=url, method=method)
-
-    return "%s&hmac=%s" % (encoded, hmac)
-
-
-def sign_get_url(secret, url, signature_paramname="hmac"):  # pragma: no cover
-    """
-    Deprecated.
-
-    Sign a URL to be GET-ed.
-
-    This function takes a URL, parses it, sorts the URL parameters in
-    alphabetical order, concatenates them with the character "&" inbetween and
-    subsequently creates an HMAC using the secret key in ``hmac_key``.
-
-    It then appends the signature in hex encoding in its own URL parameter,
-    specified by ``signature_paramname`` and returns the resulting URL.
-
-    This function is used for redirecting back to the merchant's page after a
-    call to /identify or /gettoken
-
-    :param secret: the secret key used to sign the URL
-    :type secret: str
-    :param url: the URL to sign
-    :type url: str
-    :param signature_paramname: the parameter name to append to ``url`` that
-                                will contain the signature (default: "hmac")
-    :type signature_paramname: str
-    :returns: ``str`` -- the URL, including the signature as an URL parameter
-    """
-    warnings.warn(
-        "sign_get_url is deprecated. It will be removed in a future release. "
-        "It wasn't intended for public use. It's recommended to use the core "
-        "signing API which is sign() and verify().",
-        DeprecationWarning,
-    )
-
-    parsed = urlparse(url)
-
-    if parsed.query != "":
-        # use parse_qsl, because .parse_qs seems to create problems
-        # with urlencode()
-        qs = parse_qsl(parsed.query, keep_blank_values=True)
-
-        # create string to sign
-
-        # .sort() will sort in alphabetical order
-        qs.append(("ts", str(int(time.time()))))
-        qs.sort()
-
-        hmac = sign(str(secret), qs, url, method="GET")
-
-        qs.append((signature_paramname, hmac))
-        return parsed.scheme + "://" + parsed.netloc + parsed.path + \
-            parsed.params + "?" + urlencode(qs) + parsed.fragment
-
-    return None


Test patch:
diff --git a/tests/test_client.py b/tests/test_client.py
index f3069e7..bc01797 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -47,18 +47,8 @@ class TestLaterPayClient(unittest.TestCase):
             'some-secret')
         self.item = ItemDefinition(1, 'EUR20', 'http://example.com/', 'title')
 
-    def get_qs_dict(self, url):
-        o = urlparse(url)
-        d = parse_qs(o.query)
-        o = urlparse(d['url'][0])
-        d = parse_qs(o.query)
-        return d
-
-    def get_dialog_api_furl(self, url):
-        return furl(furl(url).query.params['url'])
-
     def assertQueryString(self, url, key, value=None):
-        d = self.get_qs_dict(url)
+        d = parse_qs(urlparse(url).query)
         if not value:
             return (key in d)
         return d.get(key, None) == value
@@ -84,7 +74,7 @@ class TestLaterPayClient(unittest.TestCase):
             dialog=True,
             use_jsevents=True)
 
-        d = self.get_qs_dict(url)
+        d = parse_qs(urlparse(url).query)
         self.assertFalse('tref' in d)
 
         with self.assertRaises(APIException):
@@ -123,16 +113,6 @@ class TestLaterPayClient(unittest.TestCase):
         qd = parse_qs(urlparse(url).query)
         self.assertEqual(qd['something_more'], ['x', 'y'])
 
-    @mock.patch('laterpay.warnings.warn')
-    def test_log_warning_for_skip_add_to_invoice_deprecation(self, warning_mock):
-        item = ItemDefinition(1, 'EUR20', 'http://help.me/', 'title')
-        self.lp.get_add_url(item, skip_add_to_invoice=True,
-                            use_dialog_api=False)
-        warning_mock.assert_called_once_with("The param skip_add_to_invoice is "
-                                             "deprecated and it will be removed "
-                                             "in a future release.",
-                                             DeprecationWarning)
-
     def test_failure_url_param(self):
         item = ItemDefinition(1, 'EUR20', 'http://help.me/', 'title')
         url = self.lp.get_add_url(item, failure_url="http://example.com")
@@ -147,10 +127,10 @@ class TestLaterPayClient(unittest.TestCase):
         `product_key` "product" query param.
         """
         url = self.lp.get_add_url(self.item, product_key="hopes")
-        data = self.get_qs_dict(url)
+        data = parse_qs(urlparse(url).query)
         self.assertEqual(data['product'], ['hopes'])
         self.assertEqual(
-            str(self.get_dialog_api_furl(url).path),
+            str(furl(url).path),
             '/dialog/add',
         )
 
@@ -160,10 +140,10 @@ class TestLaterPayClient(unittest.TestCase):
         `product_key` "product" query param.
         """
         url = self.lp.get_buy_url(self.item, product_key="hopes")
-        data = self.get_qs_dict(url)
+        data = parse_qs(urlparse(url).query)
         self.assertEqual(data['product'], ['hopes'])
         self.assertEqual(
-            str(self.get_dialog_api_furl(url).path),
+            str(furl(url).path),
             '/dialog/buy',
         )
 
@@ -173,10 +153,10 @@ class TestLaterPayClient(unittest.TestCase):
         "product" query param when no `product_key` method param is used.
         """
         url = self.lp.get_add_url(self.item)
-        data = self.get_qs_dict(url)
+        data = parse_qs(urlparse(url).query)
         self.assertNotIn('product', data)
         self.assertEqual(
-            str(self.get_dialog_api_furl(url).path),
+            str(furl(url).path),
             '/dialog/add',
         )
 
@@ -186,79 +166,32 @@ class TestLaterPayClient(unittest.TestCase):
         "product" query param when no `product_key` method param is used.
         """
         url = self.lp.get_buy_url(self.item)
-        data = self.get_qs_dict(url)
+        data = parse_qs(urlparse(url).query)
         self.assertNotIn('product', data)
         self.assertEqual(
-            str(self.get_dialog_api_furl(url).path),
+            str(furl(url).path),
             '/dialog/buy',
         )
 
-    def test_get_buy_url_with_use_dialog_api_false(self):
-        """
-        Assert that `.get_buy_url()` returns a direct buy url, with no
-        dialog-api iframe, when `use_dialog_api=False`
-        """
-        url = self.lp.get_buy_url(self.item, use_dialog_api=False)
+    def test_get_buy_url(self):
+        url = self.lp.get_buy_url(self.item)
         self.assertEqual(str(furl(url).path), '/dialog/buy')
 
-    def test_get_add_url_with_use_dialog_api_false(self):
-        """
-        Assert that `.get_add_url()` returns a direct add url, with no
-        dialog-api iframe, when `use_dialog_api=False`
-        """
-        url = self.lp.get_add_url(self.item, use_dialog_api=False)
+    def test_get_add_url(self):
+        url = self.lp.get_add_url(self.item)
         self.assertEqual(str(furl(url).path), '/dialog/add')
 
     def test_get_login_dialog_url_with_use_dialog_api_false(self):
-        """
-        Assert that `.get_login_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api=False`
-        """
-        url = self.lp.get_login_dialog_url('http://example.org',
-                                           use_dialog_api=False)
-        self.assertEqual(str(furl(url).path), '/account/dialog/login')
-
-    def test_get_login_dialog_url_without_use_dialog_api(self):
-        """
-        Assert that `.get_login_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api` is not set (default)
-        """
         url = self.lp.get_login_dialog_url('http://example.org')
-        self.assertEqual(str(furl(url).path), '/dialog-api')
+        self.assertEqual(str(furl(url).path), '/account/dialog/login')
 
     def test_get_logout_dialog_url_with_use_dialog_api_false(self):
-        """
-        Assert that `.get_logout_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api=False`
-        """
-        url = self.lp.get_logout_dialog_url('http://example.org',
-                                            use_dialog_api=False)
-        self.assertEqual(str(furl(url).path), '/account/dialog/logout')
-
-    def test_get_logout_dialog_url_without_use_dialog_api(self):
-        """
-        Assert that `.get_logout_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api` is not set (default)
-        """
         url = self.lp.get_logout_dialog_url('http://example.org')
-        self.assertEqual(str(furl(url).path), '/dialog-api')
-
-    def test_get_signup_dialog_url_with_use_dialog_api_false(self):
-        """
-        Assert that `.get_signup_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api=False`
-        """
-        url = self.lp.get_signup_dialog_url('http://example.org',
-                                            use_dialog_api=False)
-        self.assertEqual(str(furl(url).path), '/account/dialog/signup')
+        self.assertEqual(str(furl(url).path), '/account/dialog/logout')
 
-    def test_get_signup_dialog_url_without_use_dialog_api(self):
-        """
-        Assert that `.get_signup_dialog_url()` returns a url with no
-        dialog-api iframe, when `use_dialog_api` is not set (default)
-        """
+    def test_get_signup_dialog_url(self):
         url = self.lp.get_signup_dialog_url('http://example.org')
-        self.assertEqual(str(furl(url).path), '/dialog-api')
+        self.assertEqual(str(furl(url).path), '/account/dialog/signup')
 
     @mock.patch('laterpay.signing.sign')
     @mock.patch('time.time')
diff --git a/tests/test_signing.py b/tests/test_signing.py
index 2f0fe02..dff73e0 100644
--- a/tests/test_signing.py
+++ b/tests/test_signing.py
@@ -5,8 +5,6 @@ from __future__ import absolute_import, print_function
 import hashlib
 import unittest
 
-from six.moves.urllib.parse import parse_qs
-
 from laterpay import signing
 
 
@@ -80,24 +78,6 @@ class TestSigningHelper(unittest.TestCase):
             '346f3d53ad762f3ed3fb7f2427dec2bbfaf0338bb7f91f0460aff15c',
         )
 
-    def test_sign_and_encode(self):
-        params = {
-            u'parĄm1': u'valuĘ',
-            'param2': ['value2', 'value3'],
-            'ts': '1330088810',
-        }
-        url = u'https://endpoint.com/api'
-
-        secret = u'secret'  # unicode is what we usually get from api/db..
-
-        signed_and_encoded = signing.sign_and_encode(secret, params, url)
-
-        self.assertEqual(
-            signed_and_encoded,
-            'param2=value2&param2=value3&par%C4%84m1=valu%C4%98&'
-            'ts=1330088810&hmac=01c928dcdbbf4ba467969ec9607bfdec0563524d93e06df7d8d3c80d'
-        )
-
     def test_verify_str_signature(self):
         params = {
             u'parĄm1': u'valuĘ',
@@ -172,71 +152,6 @@ class TestSigningHelper(unittest.TestCase):
         false_params['ts'] = '1234567890'
         self.assertFalse(signing.verify(false_params['hmac'], secret, false_params, url, method))
 
-    def test_signing_with_item(self):
-        secret = '401e9a684fcc49578c1f23176a730abc'
-        base_url = 'http://local.laterpaytest.net:8005/dialog/mmss/buy'
-        method = 'GET'
-
-        # creating this data with ItemDefinition and copy.copy(item.data) doesn't work
-        # since it has a purchase_date based on now(), so the signature isn't the same..
-        data = {
-            'article_id': 154,
-            'cp': ['laternews'],
-            'jsevents': [1],
-            'pricing': ['EUR200'],
-            'purchase_date': [1398861228815],
-            'title': [u"VIDEO: Rwanda's genocide, 20 years on"],
-            'tref': ['4ebbf443-a12e-4ce9-89e4-999ba93ba1dc'],
-            'ts': ['1398861228'],
-            'url': ['http://local.laterpaytest.net:8003/mmss/154'],
-        }
-
-        params = signing.sign_and_encode(secret, data, base_url, method)
-        expected_string = (
-            'article_id=154&'
-            'cp=laternews&'
-            'jsevents=1&'
-            'pricing=EUR200&'
-            'purchase_date=1398861228815&'
-            'title=VIDEO%3A+Rwanda%27s+genocide%2C+20+years+on&'
-            'tref=4ebbf443-a12e-4ce9-89e4-999ba93ba1dc&'
-            'ts=1398861228&'
-            'url=http%3A%2F%2Flocal.laterpaytest.net%3A8003%2Fmmss%2F154&'
-            'hmac=d51564b41c2a8719fcdcfc6bad46109d3b6c6f78afea4020d5801a3c'
-        )
-
-        self.assertEqual(expected_string, params)
-
-        # expected signature based on params above
-        signature = 'd51564b41c2a8719fcdcfc6bad46109d3b6c6f78afea4020d5801a3c'
-
-        self.assertTrue(signing.verify(signature, secret, data, base_url, method))
-
-        # changing the price in the url
-        false_string = (
-            'article_id=154&'
-            'cp=laternews&'
-            'jsevents=1&'
-            'pricing=EUR150&'
-            'purchase_date=1398861228815&'
-            'title=VIDEO%3A+Rwanda%27s+genocide%2C+20+years+on&'
-            'tref=4ebbf443-a12e-4ce9-89e4-999ba93ba1dc&'
-            'ts=1398861228&'
-            'url=http%3A%2F%2Flocal.laterpaytest.net%3A8003%2Fmmss%2F154&'
-            'hmac=4d41f1adcb7c6bf6cf9c5eb15b179fdbec667d53f2749e2845c87315'
-        )
-        false_params = parse_qs(false_string)
-
-        self.assertFalse(signing.verify(signature, secret, false_params, base_url, method))
-
-        # changing the base_url
-        false_base_url = 'http://local.laterpaytest.net:8005/dialog/mmss/add'
-        self.assertFalse(signing.verify(signature, secret, data, false_base_url, method))
-
-        # changing http method
-        false_method = 'POST'
-        self.assertFalse(signing.verify(signature, secret, data, base_url, false_method))
-
     def test_normalise_param_structure(self):
         params = {
             'key1': 'value1',