Skip to content

Commit

Permalink
#12003 source smartsheets: fix merge conflict on unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davydov-d committed Apr 18, 2022
1 parent 423cc89 commit 9eed5f7
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,26 @@ def test_check_connection_success(mocker, config):
assert status is True


columns = [
_columns = [
Mock(id="1101932201830276", title="id", type="TEXT_NUMBER"),
Mock(id="5605531829200772", title="first_name", type="TEXT_NUMBER"),
Mock(id="3353732015515524", title="last_name", type="TEXT_NUMBER"),
]


cells = [
_cells = [
Mock(column_id="1101932201830276", value="11"),
Mock(column_id="5605531829200772", value="Leonardo"),
Mock(column_id="3353732015515524", value="Dicaprio"),
]


@pytest.mark.parametrize("row", permutations(cells))
def test_different_cell_order_produces_same_result(get_sheet_mocker, config, row):
@pytest.mark.parametrize(("row", "columns"), (*((perm, _columns) for perm in permutations(_cells)), ([], _columns), ([], [])))
def test_different_cell_order_produces_same_result(get_sheet_mocker, config, row, columns):
sheet = SmartSheetAPIWrapper(config)
sheet_mock = Mock(rows=[Mock(cells=row)], columns=columns)
sheet_mock = Mock(rows=[Mock(cells=row)] if row else [], columns=columns)
get_sheet_mocker(sheet, data=Mock(return_value=sheet_mock))

records = sheet.read_records(from_dt="2020-01-01T00:00:00Z")
assert list(records) == [{"id": "11", "first_name": "Leonardo", "last_name": "Dicaprio", "modifiedAt": ANY}]
expected_records = [] if not row else [{"id": "11", "first_name": "Leonardo", "last_name": "Dicaprio", "modifiedAt": ANY}]
assert list(records) == expected_records

1 comment on commit 9eed5f7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

SonarQube Report

SonarQube report for Airbyte Connectors Source Smartsheets(#12077)

Measures

Name Value Name Value Name Value
Duplicated Lines (%) 0.0 Lines to Cover 118 Security Rating A
Duplicated Blocks 0 Code Smells 9 Lines of Code 132
Coverage 96.6 Vulnerabilities 0 Reliability Rating A
Bugs 0 Quality Gate Status OK Blocker Issues 0
Critical Issues 0 Major Issues 0 Minor Issues 9

Detected Issues

Rule File Description Message
python:mypy_assignment (MINOR) source_smartsheets/sheet.py:25 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "int", target has type "Optional[str]") . Code line: kwargs["page_size"] = 1
python:mypy_valid_type (MINOR) source_smartsheets/sheet.py:29 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: def _column_to_property(column_type: str) -> Dict[str, any]:
python:mypy_no_any_return (MINOR) source_smartsheets/sheet.py:51 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return self.data.name
python:mypy_return (MINOR) source_smartsheets/sheet.py:58 Check that function always returns a value Missing return statement . Code line: def primary_key(self) -> str:
python:mypy_no_any_return (MINOR) source_smartsheets/sheet.py:61 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return column.title
python:mypy_return_value (MINOR) source_smartsheets/sheet.py:92 Check that return value is compatible with signature Incompatible return value type (got "Tuple[bool, None]", expected "Tuple[bool, str]") . Code line: return True, None
python:mypy_valid_type (MINOR) source_smartsheets/source.py:16 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...ogger: logging.Logger, config: Mapping[str, Any]) -> Tuple[bool, any]:
python:mypy_var_annotated (MINOR) source_smartsheets/streams.py:18 Require variable annotation if type can't be inferred Need type annotation for "_state" (hint: "_state: Dict[, ] = ...") . Code line: self._state = {}
python:mypy_assignment (MINOR) source_smartsheets/streams.py:41 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Mapping[str, Any]", variable has type "Dict[Any, Any]") . Code line: self._state = value

Coverage (96.6%)

File Coverage File Coverage
source_smartsheets/init.py 100.0 source_smartsheets/sheet.py 100.0
source_smartsheets/source.py 100.0 source_smartsheets/streams.py 89.2

Please sign in to comment.