Skip to content

feat(dataconnect): Added unit tests for DataConnect API Client helpers#965

Open
mk2023 wants to merge 1 commit into
winefrom
champagne
Open

feat(dataconnect): Added unit tests for DataConnect API Client helpers#965
mk2023 wants to merge 1 commit into
winefrom
champagne

Conversation

@mk2023

@mk2023 mk2023 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Added comprehensive unit tests to TestDataConnectApiClient covering client constructor, inputs validation, variables and impersonation serialization, and service URL construction.

Added comprehensive unit tests to TestDataConnectApiClient covering client constructor, inputs validation, variables and impersonation serialization, and service URL construction.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive suite of unit tests for the _DataConnectApiClient class, covering its constructor, input validation, payload preparation, and service URL generation. The review feedback identifies critical issues in the tests, including a missing import for the dataclass decorator and references to undefined classes and attributes in the dataconnect module, both of which will cause runtime errors during test execution.

assert client1_app2 is not client1a


class TestDataConnectApiClientConstructor:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The dataclass decorator is used multiple times in the new test classes (e.g., lines 396, 402, 458, 464, 497, 503, 552, 558), but it is not imported in this test file. This will result in a NameError: name 'dataclass' is not defined when running the tests. Please import dataclass from dataclasses.

Suggested change
class TestDataConnectApiClientConstructor:
from dataclasses import dataclass
class TestDataConnectApiClientConstructor:

Comment on lines +345 to +347
def test_constructor_invalid_app(self):
with pytest.raises(ValueError, match="First argument passed to DataConnectApiClient must be a valid Firebase app instance."):
dataconnect._DataConnectApiClient(BASE_CONFIG, None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The test cases reference dataconnect._DataConnectApiClient, dataconnect.GraphqlOptions, and dataconnect.Impersonation, but these classes/attributes are not defined in firebase_admin/dataconnect.py (which is the only place they are imported from). Running these tests will result in AttributeError. Please ensure that the implementation of these helpers is included in this pull request or that the necessary files/changes are committed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant