Skip to content

Commit

Permalink
feat(python-sdk): MAX-35 - test invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianMiklaszewskiBldr committed Feb 1, 2024
1 parent c22efd2 commit 0919ec2
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 10 deletions.
1 change: 1 addition & 0 deletions .codegenignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
docker-compose.yml
DockerFile
tests/**
cleanupSite.sh
70 changes: 60 additions & 10 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: python

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -23,10 +20,63 @@ jobs:
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Tests
run: pytest tests/
env:
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
SUBDOMAIN: ${{ secrets.SUBDOMAIN }}
DOMAIN: ${{ secrets.DOMAIN }}
cleanup_site_before_tests:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3

- name: Cleanup Site
run: ./cleanupSite.sh
env:
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
SUBDOMAIN: ${{ secrets.SUBDOMAIN }}
DOMAIN: ${{ secrets.DOMAIN }}

- name: Wait 10 seconds to allow site be cleared
run: sleep 10


run_tests:
runs-on: ubuntu-latest
needs: cleanup_site_before_tests

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install deps
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Tests
run: pytest tests/
env:
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
SUBDOMAIN: ${{ secrets.SUBDOMAIN }}
DOMAIN: ${{ secrets.DOMAIN }}

cleanup_site_after_tests:
runs-on: ubuntu-latest
needs: run_tests

steps:
- uses: actions/checkout@v3

- name: Cleanup Site
run: ./cleanupSite.sh
env:
BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
SUBDOMAIN: ${{ secrets.SUBDOMAIN }}
DOMAIN: ${{ secrets.DOMAIN }}

- name: Wait 10 seconds to allow site be cleared
run: sleep 10
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.pyc
.env
.idea
6 changes: 6 additions & 0 deletions cleanupSite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
auth=$(echo "$BASIC_AUTH_USERNAME":"$BASIC_AUTH_PASSWORD" | base64)

curl --request POST \
--url https://"$SUBDOMAIN"."$DOMAIN"/sites/clear_data.json?cleanup_scope=all \
--header "Authorization: Basic $auth" \
--header 'Content-Type: application/json'

0 comments on commit 0919ec2

Please sign in to comment.