From 108b9d3bd70e7449f16c0e3a0520beb78aa40a7c Mon Sep 17 00:00:00 2001 From: Arsen Losenko <20901439+arsenlosenko@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:48:47 +0300 Subject: [PATCH] Source Pinterest: Add tests Pinterest OAuth flow (#16393) * Add tests Pinterest OAuth flow * Add test and specify consent URL value --- .../oauth/flows/PinterestOAuthFlowTest.java | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 airbyte-oauth/src/test/java/io/airbyte/oauth/flows/PinterestOAuthFlowTest.java diff --git a/airbyte-oauth/src/test/java/io/airbyte/oauth/flows/PinterestOAuthFlowTest.java b/airbyte-oauth/src/test/java/io/airbyte/oauth/flows/PinterestOAuthFlowTest.java new file mode 100644 index 000000000000..f29eded595f5 --- /dev/null +++ b/airbyte-oauth/src/test/java/io/airbyte/oauth/flows/PinterestOAuthFlowTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022 Airbyte, Inc., all rights reserved. + */ + +package io.airbyte.oauth.flows; + +import com.fasterxml.jackson.databind.JsonNode; +import io.airbyte.oauth.BaseOAuthFlow; +import io.airbyte.oauth.MoreOAuthParameters; +import java.util.Map; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert") +class PinterestOAuthFlowTest extends BaseOAuthFlowTest { + + @Override + protected BaseOAuthFlow getOAuthFlow() { + return new PinterestOAuthFlow(getConfigRepository(), getHttpClient(), this::getConstantState); + } + + @Override + protected String getExpectedConsentUrl() { + return "https://pinterest.com/oauth?client_id=test_client_id&redirect_uri=https%3A%2F%2Fairbyte.io&response_type=code&scope=ads%3Aread%2Cboards%3Aread%2Cboards%3Aread_secret%2Ccatalogs%3Aread%2Cpins%3Aread%2Cpins%3Aread_secret%2Cuser_accounts%3Aread&state=state"; + } + + @Test + @Override + void testEmptyOutputCompleteSourceOAuth() {} + + @Test + @Override + void testGetSourceConsentUrlEmptyOAuthSpec() {} + + @Test + @Override + void testValidateOAuthOutputFailure() {} + + @Test + @Override + void testCompleteSourceOAuth() {} + + @Test + @Override + void testEmptyInputCompleteDestinationOAuth() {} + + @Test + @Override + void testDeprecatedCompleteDestinationOAuth() {} + + @Test + @Override + void testDeprecatedCompleteSourceOAuth() {} + + @Test + @Override + void testEmptyOutputCompleteDestinationOAuth() {} + + @Test + @Override + void testCompleteDestinationOAuth() {} + + @Test + @Override + void testGetDestinationConsentUrlEmptyOAuthSpec() {} + + @Test + @Override + void testEmptyInputCompleteSourceOAuth() {} + + @Override + protected Map getExpectedOutput() { + return Map.of( + "access_token", "access_token_response", + "client_id", MoreOAuthParameters.SECRET_MASK, + "client_secret", MoreOAuthParameters.SECRET_MASK); + } + + @Override + protected JsonNode getCompleteOAuthOutputSpecification() { + return getJsonSchema(Map.of("access_token", Map.of("type", "string"))); + } + + @Override + protected Map getExpectedFilteredOutput() { + return Map.of( + "access_token", "access_token_response", + "client_id", MoreOAuthParameters.SECRET_MASK); + } + +}