Skip to content

Commit

Permalink
fix tests for prompt parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
owencompher authored Apr 7, 2024
1 parent df91b20 commit 46b8361
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions tests/contrib/test_discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def test_blueprint_factory():
assert discord_bp.authorization_url_params["prompt"] == "consent"


def test_blueprint_factory_with_prompt():
def test_blueprint_factory_with_prompt_consent():
discord_bp = make_discord_blueprint(
client_id="foo",
client_secret="bar",
scope=["identify", "email"],
redirect_to="index",
prompt=None,
prompt="consent",
)
assert isinstance(discord_bp, OAuth2ConsumerBlueprint)
assert discord_bp.session.scope == ["identify", "email"]
Expand All @@ -54,8 +54,25 @@ def test_blueprint_factory_with_prompt():
assert discord_bp.client_secret == "bar"
assert discord_bp.authorization_url == "https://discord.com/api/oauth2/authorize"
assert discord_bp.token_url == "https://discord.com/api/oauth2/token"
assert discord_bp.authorization_url_params["prompt"] == None
assert discord_bp.authorization_url_params["prompt"] == "consent"


def test_blueprint_factory_with_prompt_None():
discord_bp = make_discord_blueprint(
client_id="foo",
client_secret="bar",
scope=["identify", "email"],
redirect_to="index",
prompt=None,
)
assert isinstance(discord_bp, OAuth2ConsumerBlueprint)
assert discord_bp.session.scope == ["identify", "email"]
assert discord_bp.session.base_url == "https://discord.com/"
assert discord_bp.session.client_id == "foo"
assert discord_bp.client_secret == "bar"
assert discord_bp.authorization_url == "https://discord.com/api/oauth2/authorize"
assert discord_bp.token_url == "https://discord.com/api/oauth2/token"
assert discord_bp.authorization_url_params["prompt"] == "none"

def test_load_from_config(make_app):
app = make_app(redirect_to="index")
Expand Down

0 comments on commit 46b8361

Please sign in to comment.