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

Continuous Integration #6

Merged
merged 3 commits into from
Oct 31, 2022
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
40 changes: 40 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Continuous-Integration

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install Mvola package
run: python setup.py install --force --user

- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

# Mvola devportal seems to be down and unstable for the moment
# - name: Unit test
# run: CONSUMER_KEY=${{secrets.CONSUMER_KEY}} SECRET_KEY=${{secrets.SECRET_KEY}} pytest
47 changes: 47 additions & 0 deletions tests/test_transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from mvola import Mvola
from mvola.tools import Transaction
from datetime import datetime
from time import sleep
from os import environ as env
import sys


CONSUMER_KEY = env.get("CONSUMER_KEY")
SECRET_KEY = env.get("SECRET_KEY")
CALLBACK_URL = env.get("CALLBACK_URL")


def test_transaction():
if CONSUMER_KEY and SECRET_KEY:
api = Mvola(CONSUMER_KEY, SECRET_KEY, status="SANDBOX")
else:
print("Mvola error : Verify if you have .env file <CONSUMER_KEY> and <SECRET_KEY>")
sys.exit()

# GENERATE TOKEN
res = api.generate_token()
assert (res.status_code == 200)
assert (res.success)

api.token = res.response

# INITIATE TRANSACTION
transaction = Transaction(
token=api.token,
user_language="FR",
user_account_identifier="0343500003",
partner_name="Marketbot",
x_callback_url=CALLBACK_URL,
amount="555",
currency="Ar",
original_transaction_reference="orgina",
requesting_organisation_transaction_reference="ozcbajq",
description_text="fevvs",
request_date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S.999Z"),
debit="0343500003",
credit="0343500004",
)

init = api.init_transaction(transaction)
assert (init.success)
assert (init.status_code == 200)