Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliziario/hubspot oauth #7279

Merged
merged 12 commits into from
Nov 5, 2021
Merged

Eliziario/hubspot oauth #7279

merged 12 commits into from
Nov 5, 2021

Conversation

eliziario
Copy link
Contributor

@eliziario eliziario commented Oct 22, 2021

What

Implements backend OAuth for Hubspot connector
#7113

How

Inherit from BaseOAuthFlow, add new subclass to factory method, create integration test and unit tests

Recommended reading order

  1. x.java

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

@eliziario eliziario requested a review from avida October 22, 2021 11:58
@eliziario eliziario temporarily deployed to more-secrets October 22, 2021 12:08 Inactive
… returns both access_token and refresh_token
@eliziario eliziario requested a review from avida October 25, 2021 12:40
@eliziario eliziario temporarily deployed to more-secrets October 25, 2021 12:41 Inactive
@avida avida linked an issue Oct 26, 2021 that may be closed by this pull request
@@ -96,31 +94,6 @@ public String getDestinationConsentUrl(final UUID workspaceId, final UUID destin
return formatConsentUrl(destinationDefinitionId, getClientIdUnsafe(oAuthParamConfig), redirectUrl);
}

protected String formatConsentUrl(String clientId,
Copy link
Contributor

@sherifnada sherifnada Oct 28, 2021

Choose a reason for hiding this comment

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

why was this removed from the base class? other oauth flows don't depend on this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it WAS not used. Basically all the derived classes re-implement this with a lot of commonality, but also with quite a few subtle differences. It can and it should be refactored so derived classes didn't have all those copies of only-slightly-dissimilar code, but I was planning to have a specific PR just for this and other useful refactors as adding this here was going to change too many unrelated connectors. So, it is better to have a refactors-specific PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

sgtm

@eliziario eliziario temporarily deployed to more-secrets October 29, 2021 12:30 Inactive
@eliziario eliziario temporarily deployed to more-secrets October 29, 2021 12:34 Inactive
@eliziario eliziario temporarily deployed to more-secrets October 29, 2021 13:17 Inactive
@eliziario eliziario temporarily deployed to more-secrets October 29, 2021 14:39 Inactive
@eliziario eliziario temporarily deployed to more-secrets October 29, 2021 15:30 Inactive
@eliziario eliziario temporarily deployed to more-secrets November 3, 2021 12:42 Inactive
@eliziario eliziario temporarily deployed to more-secrets November 4, 2021 18:00 Inactive
@eliziario
Copy link
Contributor Author

eliziario commented Nov 4, 2021

/test connector:source-hubspot

Error: Required input 'connector' not provided

@sherifnada
Copy link
Contributor

sherifnada commented Nov 4, 2021

/test connector=source-hubspot

🕑 source-hubspot https://github.com/airbytehq/airbyte/actions/runs/1422829819
✅ source-hubspot https://github.com/airbytehq/airbyte/actions/runs/1422829819
Python tests coverage:

	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                 Stmts   Miss  Cover
	 ------------------------------------------------------------------------
	 source_acceptance_test/__init__.py                       2      0   100%
	 source_acceptance_test/base.py                          10      4    60%
	 source_acceptance_test/config.py                        75      8    89%
	 source_acceptance_test/conftest.py                     108    108     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              200     94    53%
	 source_acceptance_test/tests/test_full_refresh.py       33     22    33%
	 source_acceptance_test/tests/test_incremental.py        69     38    45%
	 source_acceptance_test/utils/__init__.py                 6      0   100%
	 source_acceptance_test/utils/asserts.py                 37      2    95%
	 source_acceptance_test/utils/common.py                  41     24    41%
	 source_acceptance_test/utils/compare.py                 62     25    60%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  891    435    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                         Stmts   Miss  Cover
	 ------------------------------------------------
	 source_hubspot/__init__.py       2      0   100%
	 source_hubspot/api.py          406     89    78%
	 source_hubspot/client.py        40     12    70%
	 source_hubspot/errors.py         6      0   100%
	 source_hubspot/source.py         4      0   100%
	 ------------------------------------------------
	 TOTAL                          458    101    78%

@jrhizor jrhizor temporarily deployed to more-secrets November 4, 2021 19:12 Inactive
@eliziario eliziario temporarily deployed to more-secrets November 5, 2021 11:42 Inactive
@eliziario eliziario merged commit c6edf13 into master Nov 5, 2021
@eliziario eliziario deleted the eliziario/hubspot_oauth branch November 5, 2021 11:59
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
* Hubspot OAuth backend implementation

* Hubspot OAuth backend implementation - post master merge fixes

* Hubspot OAuth backend implementation - missing factory

* Review changes - return only refresh_token when consent flow callback returns both access_token and refresh_token

* Missing import for OAuthImplementationFactory

* unit test fix after merge for HubspotOAuthFlowTest

* unit test fix after merge for HubspotOAuthFlowTest
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.

oAuth backend for hubspot source
4 participants