Skip to content

Commit

Permalink
attempt: fix test dependencies, move verbose_logger_test into test fo…
Browse files Browse the repository at this point in the history
…lder

Signed-off-by: jdsika <[email protected]>
  • Loading branch information
jdsika committed Nov 1, 2023
1 parent ff19b6f commit b9733af
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
12 changes: 12 additions & 0 deletions src/blockwatch/tzpro_api_constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import os
from dotenv import load_dotenv
from log_config import verbose_logger

# TODO: Check if there are changes to the indicies!
# https://docs.tzpro.io/api/index/tables/income-table

Expand Down Expand Up @@ -36,3 +40,11 @@
idx_cb_delegator_id = 0
idx_cb_current_balance = 1
idx_cb_delegator_address = 2

def load_key_from_env_variables():
load_dotenv()
try:
key = os.getenv("TZPRO_API_KEY")
except:
verbose_logger.exception("Unable to load TZPRO_API_KEY from .env file!")
return key
2 changes: 1 addition & 1 deletion src/blockwatch/tzpro_block_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from exception.api_provider import ApiProviderException
from log_config import main_logger, verbose_logger
from Constants import TZPRO_API_URL
from tzpro_reward_api import load_key_from_env_variables
from src.blockwatch.tzpro_api_constants import load_key_from_env_variables

logger = main_logger

Expand Down
15 changes: 2 additions & 13 deletions src/blockwatch/tzpro_reward_api.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
import os
from dotenv import load_dotenv

from api.reward_api import RewardApi
import math

from log_config import main_logger, verbose_logger
from log_config import main_logger
from model.reward_provider_model import RewardProviderModel
from src.blockwatch.tzpro_reward_provider_helper import TzProRewardProviderHelper
from src.blockwatch.tzpro_api_constants import load_key_from_env_variables
from Constants import MUTEZ_PER_TEZ
from Dexter import dexter_utils as dxtz

logger = main_logger


def load_key_from_env_variables():
load_dotenv()
try:
key = os.getenv("TZPRO_API_KEY")
except:
verbose_logger.exception("Unable to load TZPRO_API_KEY from .env file!")
return key


class TzProRewardApiImpl(RewardApi):
def __init__(self, nw, baking_address):
super().__init__()
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/test_api_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from src.Constants import DEFAULT_NETWORK_CONFIG_MAP, PUBLIC_NODE_URL, RewardsType
from tests.utils import Constants

from src.blockwatch.tzpro_reward_api import load_key_from_env_variables

# Block APIs
from src.tzkt.tzkt_block_api import TzKTBlockApiImpl
from src.blockwatch.tzpro_block_api import TzProBlockApiImpl
Expand All @@ -13,7 +11,7 @@
# Reward APIs
from src.tzkt.tzkt_reward_api import TzKTRewardApiImpl
from src.blockwatch.tzpro_reward_api import TzProRewardApiImpl
from src.rpc.rpc_reward_api import RpcRewardApiImpl
from src.blockwatch.tzpro_api_constants import load_key_from_env_variables

MAINNET_ADDRESS_DELEGATOR = Constants.MAINNET_ADDRESS_DELEGATOR
MAINNET_ADDRESS_STAKENOW_BAKER = Constants.MAINNET_ADDRESS_STAKENOW_BAKER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import shutil
from unittest import TestCase

from log_config import FORMATTER
from verbose_logging_helper import VerboseLoggingHelper
from src.log_config import FORMATTER
from src.verbose_logging_helper import VerboseLoggingHelper
import logging
import os

Expand Down

0 comments on commit b9733af

Please sign in to comment.