Skip to content

Commit

Permalink
馃悰 Source Monday: fix oauth test (#9144)
Browse files Browse the repository at this point in the history
* fix MondayOAuthFlowTest.java

* format
  • Loading branch information
annalvova05 committed Dec 28, 2021
1 parent 985e10f commit 141cbc5
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"access_token": "qwerty",
"subdomain": "subdomain"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import os
from abc import ABC
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Dict
from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Tuple

import requests
from airbyte_cdk.sources import AbstractSource
Expand Down Expand Up @@ -128,7 +128,7 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str,


class MondayAuthentication:
""" Provides the authentication capabilities for both old and new methods. """
"""Provides the authentication capabilities for both old and new methods."""

def __init__(self, config: Dict):
self.config = config
Expand All @@ -145,7 +145,7 @@ def get_token(self):
return token

def get_auth(self) -> TokenAuthenticator:
""" Return the TokenAuthenticator object with access or api token. """
"""Return the TokenAuthenticator object with access or api token."""
return TokenAuthenticator(token=self.get_token())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
{
"type": "object",
"title": "OAuth2.0",
"required": ["auth_type", "client_id", "client_secret", "access_token"],
"required": [
"auth_type",
"client_id",
"client_secret",
"access_token"
],
"properties": {
"subdomain": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

package io.airbyte.oauth.flows;

import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.commons.json.Jsons;
import io.airbyte.oauth.BaseOAuthFlow;
import io.airbyte.oauth.MoreOAuthParameters;
import java.util.Map;
import org.junit.jupiter.api.Test;

public class MondayOAuthFlowTest extends BaseOAuthFlowTest {

Expand All @@ -15,7 +20,49 @@ protected BaseOAuthFlow getOAuthFlow() {

@Override
protected String getExpectedConsentUrl() {
return "https://auth.monday.com/oauth2/authorize?client_id=test_client_id&redirect_uri=https%3A%2F%2Fairbyte.io&state=state&scope=me:read%20boards:read%20workspaces:read%20users:read%20account:read%20updates:read%20assets:read%20tags:read%20teams:read";
return "https://auth.monday.com/oauth2/authorize?client_id=test_client_id&redirect_uri=https%3A%2F%2Fairbyte.io&scope=me%3Aread+boards%3Aread+workspaces%3Aread+users%3Aread+account%3Aread+updates%3Aread+assets%3Aread+tags%3Aread+teams%3Aread&state=state&subdomain=test_subdomain";
}

@Override
protected JsonNode getInputOAuthConfiguration() {
return Jsons.jsonNode(Map.of("subdomain", "test_subdomain"));
}

@Override
protected JsonNode getUserInputFromConnectorConfigSpecification() {
return getJsonSchema(Map.of("subdomain", Map.of("type", "string")));
}

@Test
public void testGetSourceConsentUrlEmptyOAuthSpec() {}

@Test
public void testGetDestinationConsentUrlEmptyOAuthSpec() {}

@Test
public void testDeprecatedCompleteDestinationOAuth() {}

@Test
public void testDeprecatedCompleteSourceOAuth() {}

@Override
protected Map<String, String> 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<String, String> getExpectedFilteredOutput() {
return Map.of(
"access_token", "access_token_response",
"client_id", MoreOAuthParameters.SECRET_MASK);
}

}

0 comments on commit 141cbc5

Please sign in to comment.