-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
154ca15
commit 27caeb2
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from __future__ import annotations | ||
|
||
import typing as t | ||
|
||
import pytest | ||
|
||
from singer_sdk.helpers.capabilities import CapabilitiesEnum, TargetCapabilities | ||
from singer_sdk.target_base import SQLTarget | ||
|
||
|
||
class SQLTargetMock(SQLTarget): | ||
name = "sql-target-mock" | ||
|
||
def __init_subclass__( | ||
cls, | ||
*, | ||
capabilities: t.Iterable[CapabilitiesEnum], | ||
**kwargs: t.Any, | ||
): | ||
super().__init_subclass__(**kwargs) | ||
cls.capabilities = [*capabilities] | ||
cls.config_jsonschema = {"properties": {}} | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"capabilities,expected_settings", | ||
[ | ||
pytest.param([], set(), id="no capabilities"), | ||
pytest.param( | ||
[TargetCapabilities.TARGET_SCHEMA], | ||
{"default_target_schema"}, | ||
id="default schema", | ||
), | ||
pytest.param( | ||
[TargetCapabilities.HARD_DELETE], | ||
{"hard_delete"}, | ||
id="hard delete", | ||
), | ||
], | ||
) | ||
def test_target_about_info( | ||
capabilities: list[CapabilitiesEnum], | ||
expected_settings: set[str], | ||
): | ||
class MyTarget(SQLTargetMock, capabilities=capabilities): | ||
pass | ||
|
||
about = MyTarget._get_about_info() | ||
default_settings = {"add_record_metadata", "load_method"} | ||
assert set(about.settings["properties"]) == expected_settings | default_settings |