Skip to content

Commit

Permalink
revert the project_id as optional argument at the end of the parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mildophin committed Sep 3, 2024
1 parent 9b8fec9 commit c4e7fb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pasqal_cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class SDK:

def __init__(
self,
project_id: str,
username: Optional[str] = None,
password: Optional[str] = None,
token_provider: Optional[TokenProvider] = None,
endpoints: Optional[Endpoints] = None,
auth0: Optional[Auth0Conf] = None,
webhook: Optional[str] = None,
project_id: Optional[str] = None,
):
"""
This class provides helper methods to call the PASQAL Cloud endpoints.
Expand All @@ -86,6 +86,9 @@ def __init__(
project_id: ID of the owner project of the batch.
"""

if not project_id:
raise ValueError("You need to provide a project_id")

self._client = Client(
project_id=project_id,
username=username,
Expand Down
10 changes: 10 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ def test_module_bad_password(self):


class TestAuthInvalidClient(TestSDKCommonAttributes):
def test_module_no_project_id(self):
with pytest.raises(
ValueError,
match="You need to provide a project_id",
):
SDK(
username=self.username,
password=self.password,
)

def test_module_no_user_with_password(self):
with pytest.raises(
ValueError,
Expand Down

0 comments on commit c4e7fb8

Please sign in to comment.