Merge branch 'python39' into 'v2.9.x'

Add  Python3.9 Testing

See merge request allianceauth/allianceauth!1284
This commit is contained in:
Ariel Rin 2021-04-08 04:49:15 +00:00
commit 1ec6929e91
4 changed files with 38 additions and 14 deletions

View File

@ -64,6 +64,21 @@ test-3.8-core:
reports: reports:
cobertura: coverage.xml cobertura: coverage.xml
test-3.9-core:
image: python:3.9-buster
script:
- tox -e py39-core
before_script:
- apt-get update && apt-get install redis-server -y
- redis-server --daemonize yes
- redis-cli ping
- python -V
- pip install wheel tox
artifacts:
when: always
reports:
cobertura: coverage.xml
test-3.6-all: test-3.6-all:
image: python:3.6-buster image: python:3.6-buster
script: script:
@ -109,9 +124,24 @@ test-3.8-all:
reports: reports:
cobertura: coverage.xml cobertura: coverage.xml
test-3.9-all:
image: python:3.9-buster
script:
- tox -e py39-all
before_script:
- apt-get update && apt-get install redis-server -y
- redis-server --daemonize yes
- redis-cli ping
- python -V
- pip install wheel tox
artifacts:
when: always
reports:
cobertura: coverage.xml
deploy_production: deploy_production:
stage: deploy stage: deploy
image: python:3.8-buster image: python:3.9-buster
before_script: before_script:
- pip install twine wheel - pip install twine wheel

View File

@ -12,20 +12,12 @@ import base64
import hmac import hmac
import hashlib import hashlib
try: from urllib.parse import unquote, urlencode, parse_qs
from urllib import unquote, urlencode
except ImportError: #py3
from urllib.parse import unquote, urlencode
try:
from urlparse import parse_qs
except ImportError: #py3
from urllib.parse import parse_qs
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
ACCESS_PERM = 'discourse.access_discourse' ACCESS_PERM = 'discourse.access_discourse'
@ -55,7 +47,7 @@ def discourse_sso(request):
# Validate the payload # Validate the payload
try: try:
payload = unquote(payload).encode('utf-8') payload = unquote(payload).encode('utf-8')
decoded = base64.decodestring(payload).decode('utf-8') decoded = base64.decodebytes(payload).decode('utf-8')
assert 'nonce' in decoded assert 'nonce' in decoded
assert len(payload) > 0 assert len(payload) > 0
except AssertionError: except AssertionError:
@ -86,7 +78,7 @@ def discourse_sso(request):
if main_char: if main_char:
params['avatar_url'] = main_char.portrait_url(256) params['avatar_url'] = main_char.portrait_url(256)
return_payload = base64.encodestring(urlencode(params).encode('utf-8')) return_payload = base64.encodebytes(urlencode(params).encode('utf-8'))
h = hmac.new(key, return_payload, digestmod=hashlib.sha256) h = hmac.new(key, return_payload, digestmod=hashlib.sha256)
query_string = urlencode({'sso': return_payload, 'sig': h.hexdigest()}) query_string = urlencode({'sso': return_payload, 'sig': h.hexdigest()})

View File

@ -76,10 +76,11 @@ setup(
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Operating System :: POSIX :: Linux', 'Operating System :: POSIX :: Linux',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
], ],

View File

@ -1,7 +1,7 @@
[tox] [tox]
skipsdist = true skipsdist = true
usedevelop = true usedevelop = true
envlist = py{36,37,38}-{all} envlist = py{36,37,38,39}-{all}
[testenv] [testenv]
setenv = setenv =
@ -11,6 +11,7 @@ basepython =
py36: python3.6 py36: python3.6
py37: python3.7 py37: python3.7
py38: python3.8 py38: python3.8
py39: python3.9
deps= deps=
coverage coverage
install_command = pip install -e ".[testing]" -U {opts} {packages} install_command = pip install -e ".[testing]" -U {opts} {packages}