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

Update proposal.details type and add additional proposal field types #2461

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ jobs:
pip install -r requirements.txt
python ./setup.py
python -m pytest --alluredir allure-results
if [[ "${{ env.NETWORK }}" == "preprod" ]]; then
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREPROD }}" >> $GITHUB_ENV
elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_SANCHONET }}" >> $GITHUB_ENV
kneerose marked this conversation as resolved.
Show resolved Hide resolved
else
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREVIEW }}" >> $GITHUB_ENV
fi
env:
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
FAUCET_API_KEY: ${{ secrets.FAUCET_API_KEY }}
KUBER_API_URL: https://kuber-govtool.cardanoapi.io
NETWORK: ${{ vars.NETWORK }}
KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }}

- name: Upload report
if: always()
Expand Down
3 changes: 2 additions & 1 deletion tests/govtool-backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ METRICS_API_SECRET= `api_secret`
# required for setup
KUBER_API_URL = "https://kuber-govtool.cardanoapi.io"
KUBER_API_KEY = "" # optional
FAUCET_API_KEY= """
FAUCET_API_KEY= """
NETWORK= preview
4 changes: 3 additions & 1 deletion tests/govtool-backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

RECORD_METRICS_API = os.getenv("RECORD_METRICS_API")
METRICS_API_SECRET = os.getenv("METRICS_API_SECRET")
KUBER_API_URL = os.getenv("KUBER_API_URL")
KUBER_API_URL = f'https://{os.getenv("NETWORK","preview")}.kuber.cardanoapi.io'
KUBER_API_KEY = os.getenv("KUBER_API_KEY")
FAUCET_API_URL = f'https://faucet.${os.getenv("NETWORK","preview")}.world.dev.cardano.org'
FACUET_API_KEY = os.getenv("FAUCET_API_KEY")
5 changes: 3 additions & 2 deletions tests/govtool-backend/lib/faucet_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from config import FAUCET_API_URL,FACUET_API_KEY
import os
from typing import TypedDict

Expand All @@ -21,8 +22,8 @@ def __init__(self, api_key: str, base_url: str = "https://faucet.sanchonet.world

@staticmethod
def from_env():
api_key = os.getenv("FAUCET_API_KEY")
base_url = os.getenv("FAUCET_API_URL", "https://faucet.sanchonet.world.dev.cardano.org")
api_key = FACUET_API_KEY
base_url = FAUCET_API_URL
if not api_key:
raise ValueError("FAUCET_API_KEY environment variable not set.")
return CardanoFaucet(api_key, base_url)
Expand Down
6 changes: 4 additions & 2 deletions tests/govtool-backend/lib/kuber_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from config import KUBER_API_KEY,KUBER_API_URL
import sys
import time
from typing import Any, Optional
Expand Down Expand Up @@ -69,11 +70,12 @@ def wait_for_txout(self, txin: str, timeout=400, log: bool = False):

@staticmethod
def from_env() -> "KuberApi":
api_url = os.environ.get("KUBER_API_URL")
api_url = KUBER_API_URL
print(f"KUBER_API_URL: {api_url}")
if api_url is not None:
api_url = api_url[:-1] if api_url.endswith("/") else api_url
print(f"KUBER_API_URL: {api_url}")
api_key = os.environ.get("KUBER_API_KEY")
api_key = KUBER_API_KEY
return KuberApi(api_url, api_key)
else:
print("KUBER_API_URL environment variable is not set.", file=sys.stderr)
Expand Down
5 changes: 4 additions & 1 deletion tests/govtool-backend/models/TestData.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class Proposal(TypedDict):
txHash: str
index: int
type: str
details: Optional[dict]
details: Optional[dict] | Optional[list]
expiryDate: str
expiryEpochNo: int
createdDate: str
createdEpochNo: int
url: str
metadataHash: str
protocolParams: Optional[dict]
title: Optional[str]
abstract: Optional[str]
motivation: Optional[str]
Expand All @@ -38,6 +39,8 @@ class Proposal(TypedDict):
poolYesVotes: int
poolNoVotes: int
poolAbstainVotes: int
prevGovActionIndex: Optional[int]
prevGovActionTxHash: Optional[str]


class Drep(TypedDict):
Expand Down
Loading