Skip to content

Commit

Permalink
Merge pull request #759 from OpenIDC/fix-quality
Browse files Browse the repository at this point in the history
Fix for black update
  • Loading branch information
tpazderka authored Oct 1, 2020
2 parents 781b59a + de362e2 commit eecba3b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
5 changes: 4 additions & 1 deletion docker/integration_tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends\
libgconf-2-4 \
libnss3-tools \
ntp \
wget
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN wget -q https://deb.nodesource.com/setup_12.x -O - | bash -
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt-get install -y --no-install-recommends \
google-chrome-stable \
libxss1 \
nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand Down
6 changes: 5 additions & 1 deletion src/oic/oauth2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ def construct_AccessTokenRequest(
request_args = {}
if not issubclass(
request,
(ROPCAccessTokenRequest, CCAccessTokenRequest, ExtensionTokenRequest,),
(
ROPCAccessTokenRequest,
CCAccessTokenRequest,
ExtensionTokenRequest,
),
):
grant = self.get_grant(**kwargs)

Expand Down
4 changes: 3 additions & 1 deletion src/oic/oauth2/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ def __init__(
)
self.cdb = cdb
self.server = server_cls(
keyjar=keyjar, message_factory=message_factory, settings=self.settings,
keyjar=keyjar,
message_factory=message_factory,
settings=self.settings,
)

self.authn_broker = authn_broker
Expand Down
4 changes: 3 additions & 1 deletion src/oic/oic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,9 @@ def __init__(
self.settings.timeout = timeout

super().__init__(
keyjar=keyjar, message_factory=message_factory, settings=self.settings,
keyjar=keyjar,
message_factory=message_factory,
settings=self.settings,
)

@staticmethod
Expand Down
6 changes: 4 additions & 2 deletions tests/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,10 @@ def test_request_info_simple(self):

assert uri == self.authorization_endpoint
body_elts = body.split("&")
expected_body = "state=hmm&redirect_uri={}&response_type=code&client_id=1".format(
quote(self.redirect_uri, safe="")
expected_body = (
"state=hmm&redirect_uri={}&response_type=code&client_id=1".format(
quote(self.redirect_uri, safe="")
)
)
expected_body_elts = expected_body.split("&")
assert set(body_elts) == set(expected_body_elts)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_oauth2_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ def test_multiple_scopes_urlencoded(self):
)
ue = ar.to_urlencoded()
ue_splits = ue.split("&")
expected_ue_splits = "scope=openid+foxtrot&response_type=code+token&client_id=foobar".split(
"&"
expected_ue_splits = (
"scope=openid+foxtrot&response_type=code+token&client_id=foobar".split("&")
)
assert _eq(ue_splits, expected_ue_splits)

Expand Down
7 changes: 5 additions & 2 deletions tests/utils/test_client_management_run.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import tempfile
from subprocess import PIPE
from subprocess import STDOUT
Expand All @@ -22,11 +23,13 @@ def db_file_path():


class TestClientManagementRun(object):
@pytest.mark.xfail(sys.version_info < (3, 6), reason="Deprecation in cryptography")
def test_help_prints_usage_instructions(self):
result = run(CLI_INVOCATION + "--help", shell=True, stdout=PIPE, stderr=PIPE)
assert result.stdout.decode().startswith("usage: ")
assert result.stderr.decode() == ""

@pytest.mark.xfail(sys.version_info < (3, 6), reason="Deprecation in cryptography")
def test_list_option_with_empty_db_lists_nothing(self, db_file_path):
for list_option_form in ("-l", "--list"):
result = run(
Expand Down Expand Up @@ -54,7 +57,7 @@ def test_list_option_with_1_client_id_in_db(self, db_file_path):
stdout=PIPE,
stderr=STDOUT,
)
assert result.stdout.decode().splitlines() == ["the_first"]
assert "the_first" in result.stdout.decode().splitlines()

def test_list_option_with_2_client_ids_in_db(self, db_file_path):
client_ids = {"the_first", "the_2nd"}
Expand All @@ -78,4 +81,4 @@ def test_list_option_with_2_client_ids_in_db(self, db_file_path):
stdout=PIPE,
stderr=STDOUT,
)
assert set(result.stdout.decode().splitlines()) == client_ids
assert client_ids <= set(result.stdout.decode().splitlines())

0 comments on commit eecba3b

Please sign in to comment.