Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SermetPekin committed Apr 20, 2024
1 parent 35a73a2 commit 70a031c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
36 changes: 4 additions & 32 deletions evdspy/EVDSlocal/tests/test_user_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,23 @@
default_end_date_fnc, get_series
from evdspy.EVDSlocal.utils.github_actions import GithubActions
from evdspy.EVDSlocal.utils.utils_general import get_env_api_key
from evdspy.EVDSlocal.utils.utils_test import get_api_key_while_testing, ApiClassWhileTesting, get_api_key_file
from evdspy.EVDSlocal.utils.utils_test import get_api_key_while_testing, ApiClassWhileTesting, get_api_key_file, \
skip_if_gthub, skip_if_not_keyvalid, is_df
from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import Frequency, freq_enum, Formulas, AggregationType, \
correct_types
# from evdspy.EVDSlocal.index_requests.user_requests import
from evdspy.EVDSlocal.config.apikey_class import ApikeyClass
from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import default_start_date_fnc, default_end_date_fnc
from evdspy.EVDSlocal.index_requests.user_requests.user_requests import ProxyManager, UrlBuilder, UrlSeries, \
ApiRequester, \
DataProcessor, RequestConfig
ApiRequester, DataProcessor, RequestConfig
# from evdspy.EVDSlocal.index_requests.get_series_indexes_utils import *

try:

import pytest
except ImportError:
pass
import sys


def get_api_key():
import os
return os.getenv("EVDS_API_KEY")


# assert isinstance(get_api_key(), str) and len(get_api_key()) == 10
def key_valid():
return isinstance(get_api_key(), str) and len(get_api_key()) == 10


def is_df(df: Any):
return isinstance(df, pd.DataFrame)


def gth_testing():
return GithubActions().is_testing()


reason_gth = "passing when github Actions "

skip_if_gthub = pytest.mark.skipif(
gth_testing, reason=reason_gth
)

skip_if_not_keyvalid = pytest.mark.skipif(
key_valid(), reason='No Api key Valid provided'
)


@skip_if_gthub
Expand Down
32 changes: 32 additions & 0 deletions evdspy/EVDSlocal/utils/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@

"""Globals """
EVDS_API_KEY_ENV_NAME = "EVDS_API_KEY"
try:
import pytest
except ImportError:
pass


def get_api_key():
import os
return os.getenv("EVDS_API_KEY")


def key_valid():
return isinstance(get_api_key(), str) and len(get_api_key()) == 10


def is_df(df: Any):
Expand All @@ -32,6 +45,25 @@ def gth_testing():

reason_gth = "passing when github Actions "

skip_if_gthub = pytest.mark.skipif(
gth_testing, reason=reason_gth
)

skip_if_not_keyvalid = pytest.mark.skipif(
key_valid(), reason='No Api key Valid provided'
)


# def is_df(df: Any):
# return isinstance(df, pd.DataFrame)


# def gth_testing():
# return GithubActions().is_testing()


# reason_gth = "passing when github Actions "
#

def get_api_env_key_name():
return EVDS_API_KEY_ENV_NAME
Expand Down

0 comments on commit 70a031c

Please sign in to comment.