Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions supabase/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ def __init__(
if not re.match(r"^(https?)://.+", supabase_url):
raise SupabaseException("Invalid URL")

# Check if the key is a valid JWT
if not re.match(
r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", supabase_key
):
raise SupabaseException("Invalid API key")

if options is None:
options = ClientOptions(storage=AsyncMemoryStorage())

Expand Down
6 changes: 0 additions & 6 deletions supabase/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ def __init__(
if not re.match(r"^(https?)://.+", supabase_url):
raise SupabaseException("Invalid URL")

# Check if the key is a valid JWT
if not re.match(
r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", supabase_key
):
raise SupabaseException("Invalid API key")

if options is None:
options = ClientOptions(storage=SyncMemoryStorage())

Expand Down
17 changes: 1 addition & 16 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
from __future__ import annotations

import os
from typing import Any
from unittest.mock import MagicMock

import pytest
from gotrue import SyncMemoryStorage

from supabase import Client, ClientOptions, SupabaseException, create_client


@pytest.mark.xfail(
reason="None of these values should be able to instantiate a client object"
)
@pytest.mark.parametrize("url", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []])
@pytest.mark.parametrize("key", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []])
def test_incorrect_values_dont_instantiate_client(url: Any, key: Any) -> None:
"""Ensure we can't instantiate client with invalid values."""
try:
_: Client = create_client(url, key)
except SupabaseException as e:
pass
from supabase import ClientOptions, create_client


def test_function_initialization() -> None:
Expand Down