Hello community, here is the log from the commit of package python-PyFxA for openSUSE:Factory checked in at 2019-03-28 22:49:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-PyFxA (Old) and /work/SRC/openSUSE:Factory/.python-PyFxA.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyFxA" Thu Mar 28 22:49:15 2019 rev:5 rq:689288 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-PyFxA/python-PyFxA.changes 2019-01-24 14:02:42.396100019 +0100 +++ /work/SRC/openSUSE:Factory/.python-PyFxA.new.25356/python-PyFxA.changes 2019-03-28 22:49:18.807047928 +0100 @@ -1,0 +2,9 @@ +Tue Mar 26 12:47:52 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 0.7.1: + * Fix test bustage due to session verification. + * Add support for TOTP. +- Add missing deps +- Enable tests + +------------------------------------------------------------------- Old: ---- PyFxA-0.6.0.tar.gz New: ---- PyFxA-0.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PyFxA.spec ++++++ --- /var/tmp/diff_new_pack.VCO5ou/_old 2019-03-28 22:49:19.631047779 +0100 +++ /var/tmp/diff_new_pack.VCO5ou/_new 2019-03-28 22:49:19.631047779 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-PyFxA # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017-2018 The openSUSE Project. # # All modifications and additions to the file contributed by third parties @@ -18,16 +18,24 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_with test Name: python-PyFxA -Version: 0.6.0 +Version: 0.7.1 Release: 0 Summary: Firefox Accounts client library for Python License: MPL-2.0 Group: Development/Languages/Python -Url: https://github.com/mozilla/PyFxA +URL: https://github.com/mozilla/PyFxA Source: https://files.pythonhosted.org/packages/source/P/PyFxA/PyFxA-%{version}.tar.gz +BuildRequires: %{python_module PyBrowserID} +BuildRequires: %{python_module cryptography} +BuildRequires: %{python_module hawkauthlib} +BuildRequires: %{python_module mock} +BuildRequires: %{python_module pyotp} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests >= 2.4.2} +BuildRequires: %{python_module responses} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-PyBrowserID @@ -35,15 +43,8 @@ Requires: python-requests >= 2.4.2 Requires: python-six BuildArch: noarch -%if %{with test} -BuildRequires: %{python_module PyBrowserID} -BuildRequires: %{python_module cryptography} -BuildRequires: %{python_module grequests} -BuildRequires: %{python_module hawkauthlib} -BuildRequires: %{python_module mock} -BuildRequires: %{python_module requests >= 2.4.2} -BuildRequires: %{python_module responses} -BuildRequires: %{python_module six} +%ifpython3 +Requires: python-setuptools %endif %python_subpackages @@ -53,6 +54,9 @@ %prep %setup -q -n PyFxA-%{version} sed -i -e '/^#!\/usr\/bin\/env python/d' fxa/__main__.py +# Remove online tests +rm -f fxa/tests/test_core.py +find ./ -type f -exec chmod -x {} + %build %python_build @@ -61,10 +65,9 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check -%python_exec setup.py test -%endif +# test_monkey_patch_for_gevent gevent no longer packaged as it is deprecated +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} -v -k 'not test_monkey_patch_for_gevent' fxa/tests/ %files %{python_files} %doc CHANGES.txt README.rst ++++++ PyFxA-0.6.0.tar.gz -> PyFxA-0.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/CHANGES.txt new/PyFxA-0.7.1/CHANGES.txt --- old/PyFxA-0.6.0/CHANGES.txt 2018-05-04 05:15:58.000000000 +0200 +++ new/PyFxA-0.7.1/CHANGES.txt 2019-03-18 03:07:37.000000000 +0100 @@ -3,6 +3,18 @@ This document describes changes between each past release. +0.7.1 (2019-03-18) +================== + +- Fix test bustage due to session verification. + + +0.7.0 (2019-03-18) +================== + +- Add support for TOTP. + + 0.6.0 (2018-05-04) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/PKG-INFO new/PyFxA-0.7.1/PKG-INFO --- old/PyFxA-0.6.0/PKG-INFO 2018-05-04 05:16:16.000000000 +0200 +++ new/PyFxA-0.7.1/PKG-INFO 2019-03-18 03:08:26.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyFxA -Version: 0.6.0 +Version: 0.7.1 Summary: Firefox Accounts client library for Python Home-page: https://github.com/mozilla/PyFxA Author: Mozilla Services @@ -313,6 +313,18 @@ This document describes changes between each past release. + 0.7.1 (2019-03-18) + ================== + + - Fix test bustage due to session verification. + + + 0.7.0 (2019-03-18) + ================== + + - Add support for TOTP. + + 0.6.0 (2018-05-04) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/PyFxA.egg-info/PKG-INFO new/PyFxA-0.7.1/PyFxA.egg-info/PKG-INFO --- old/PyFxA-0.6.0/PyFxA.egg-info/PKG-INFO 2018-05-04 05:16:14.000000000 +0200 +++ new/PyFxA-0.7.1/PyFxA.egg-info/PKG-INFO 2019-03-18 03:08:25.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyFxA -Version: 0.6.0 +Version: 0.7.1 Summary: Firefox Accounts client library for Python Home-page: https://github.com/mozilla/PyFxA Author: Mozilla Services @@ -313,6 +313,18 @@ This document describes changes between each past release. + 0.7.1 (2019-03-18) + ================== + + - Fix test bustage due to session verification. + + + 0.7.0 (2019-03-18) + ================== + + - Add support for TOTP. + + 0.6.0 (2018-05-04) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/dev-requirements.txt new/PyFxA-0.7.1/dev-requirements.txt --- old/PyFxA-0.6.0/dev-requirements.txt 2016-11-29 05:47:40.000000000 +0100 +++ new/PyFxA-0.7.1/dev-requirements.txt 2018-12-13 09:20:11.000000000 +0100 @@ -2,3 +2,4 @@ mock responses unittest2 +pyotp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/fxa/core.py new/PyFxA-0.7.1/fxa/core.py --- old/PyFxA-0.6.0/fxa/core.py 2018-04-03 00:53:17.000000000 +0200 +++ new/PyFxA-0.7.1/fxa/core.py 2019-01-29 05:49:55.000000000 +0100 @@ -97,6 +97,7 @@ token=resp["sessionToken"], key_fetch_token=resp.get("keyFetchToken"), verified=resp["verified"], + verificationMethod=resp.get("verificationMethod"), auth_timestamp=resp["authAt"], ) @@ -247,13 +248,14 @@ class Session(object): def __init__(self, client, email, stretchpwd, uid, token, - key_fetch_token=None, verified=False, auth_timestamp=0, - cert_keypair=None): + key_fetch_token=None, verified=False, verificationMethod=None, + auth_timestamp=0, cert_keypair=None): self.client = client self.email = email self.uid = uid self.token = token self.verified = verified + self.verificationMethod = verificationMethod self.auth_timestamp = auth_timestamp self.cert_keypair = None self.keys = None @@ -321,6 +323,30 @@ url = "/recovery_email/resend_code" self.apiclient.post(url, body, auth=self._auth) + def totp_create(self): + url = "/totp/create" + return self.apiclient.post(url, {}, auth=self._auth) + + def totp_exists(self): + url = "/totp/exists" + resp = self.apiclient.get(url, auth=self._auth) + return resp["exists"] + + def totp_delete(self): + url = "/totp/destroy" + return self.apiclient.post(url, {}, auth=self._auth) + + def totp_verify(self, code): + url = "/session/verify/totp" + body = { + "code": code, + } + resp = self.apiclient.post(url, body, auth=self._auth) + if resp["success"]: + self.verified = True + + return resp["success"] + def sign_certificate(self, public_key, duration=DEFAULT_CERT_DURATION, service=None): body = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/fxa/tests/test_core.py new/PyFxA-0.7.1/fxa/tests/test_core.py --- old/PyFxA-0.6.0/fxa/tests/test_core.py 2018-05-02 02:42:50.000000000 +0200 +++ new/PyFxA-0.7.1/fxa/tests/test_core.py 2019-03-18 03:07:08.000000000 +0100 @@ -6,6 +6,8 @@ from six import binary_type from six.moves.urllib.parse import urlparse +import pyotp + from browserid import jwt import browserid.tests.support import browserid.utils @@ -223,6 +225,7 @@ m = self.acct.wait_for_email(lambda m: "x-verify-code" in m["headers"]) if not m: raise RuntimeError("Verification email was not received") + self.acct.clear() self.session.verify_email_code(m["headers"]["x-verify-code"]) # Fetch the keys. self.session.fetch_keys() @@ -288,6 +291,14 @@ # Check that we can use the new password. session2 = self.client.login(self.acct.email, newpwd, keys=True) + if not session2.get_email_status().get("verified"): + def has_verify_code(m): + return "x-verify-code" in m["headers"] + m = self.acct.wait_for_email(has_verify_code) + if not m: + raise RuntimeError("Verification email was not received") + self.acct.clear() + session2.verify_email_code(m["headers"]["x-verify-code"]) # Check that encryption keys have been preserved. session2.fetch_keys() @@ -328,3 +339,30 @@ service="test-me") data = browserid.verify(assertion, audience="http://example.com") self.assertEquals(data["status"], "okay") + + def test_totp(self): + resp = self.session.totp_create() + + # Double create causes a client error + with self.assertRaises(fxa.errors.ClientError): + self.session.totp_create() + + # Created but not verified returns false (and deletes the token) + self.assertFalse(self.session.totp_exists()) + + # Creating again should work this time + resp = self.session.totp_create() + + # Verify the code + code = pyotp.TOTP(resp["secret"]).now() + self.assertTrue(self.session.totp_verify(code)) + self.assertTrue(self.session.verified) + + # Should exist now + self.assertTrue(self.session.totp_exists()) + + # Remove the code + resp = self.session.totp_delete() + + # And now should not exist + self.assertFalse(self.session.totp_exists()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/setup.cfg new/PyFxA-0.7.1/setup.cfg --- old/PyFxA-0.6.0/setup.cfg 2018-05-04 05:16:16.000000000 +0200 +++ new/PyFxA-0.7.1/setup.cfg 2019-03-18 03:08:26.000000000 +0100 @@ -10,5 +10,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyFxA-0.6.0/setup.py new/PyFxA-0.7.1/setup.py --- old/PyFxA-0.6.0/setup.py 2018-05-04 05:15:19.000000000 +0200 +++ new/PyFxA-0.7.1/setup.py 2019-03-18 03:07:21.000000000 +0100 @@ -48,7 +48,7 @@ setup(name="PyFxA", - version='0.6.0', + version='0.7.1', description="Firefox Accounts client library for Python", long_description=README + "\n\n" + CHANGES, classifiers=[