Skip to content

Commit

Permalink
Fixed installation issues and refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreu Vallbona committed Jun 21, 2017
1 parent 7a5f8e4 commit 1ea1cde
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 83 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
Change log
==========

0.2.6 (2017-06-21)
------------------

* Fixed installation issues and refactored tests


0.2.3 (2017-06-21)
------------------

* Fixed get_version issue on setup.py


0.2 (2017-06-21)
----------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017 Marc Galofré - APSL
Copyright (c) 2017 - APSL

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include AUTHORS
include LICENSE
include CHANGELOG
include CHANGELOG.rst
include README.rst
recursive-include addonpayments-sdk-python *
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
AddonPayments SDK Python
========================

.. image:: https://img.shields.io/pypi/v/addonpayments-sdk-python.svg
:target: https://pypi.python.org/pypi/addonpayments-sdk-python

AddonPayments SDK Python is a library that allows integration with the SDK's of AddonPayments in a easy and fast way.
There are two types of integration: HPP (Hosted Payment Page) and API.

Expand Down
2 changes: 1 addition & 1 deletion addonpayments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = 'Marc Galofré'
__email__ = '[email protected]'
__version__ = '0.2'
__version__ = '0.2.6'
Empty file.
65 changes: 0 additions & 65 deletions addonpayments/hpp/tests/conftest.py

This file was deleted.

28 changes: 19 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,32 @@ def get_email(package):
return re.search("^__email__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1)


def get_long_description():
"""
return the long description from README.rst file
:return:
"""
return codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read()


setup(
name='addonpayments-sdk-python',
version=get_version('addonpayments'),
packages=find_packages(exclude=('*.tests*')),
include_package_data=True,
keywords="addonpayments sdk python hpp api",
author=get_author('addonpayments'),
author_email=get_email('addonpayments'),
url='https://github.com/ComerciaGP/addonpayments-Python-SDK',
packages=find_packages(),
license='BSD',
description='A SDK Addonpayments implemented with Python.',
long_description=codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read(),
long_description=get_long_description(),
install_requires=[
'six',
'python-decouple',
'attrs',
'xmltodict',
'requests',
'future'
'future',
],
url='https://gitlab.apsl.net/addonpayments/addonpayments-sdk-python',
author=get_author('addonpayments'),
author_email=get_email('addonpayments'),
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
Expand All @@ -62,5 +70,7 @@ def get_email(package):
'Programming Language :: Python :: 3.5',
'Operating System :: OS Independent',
'Topic :: Software Development'
]
],
include_package_data=True,
zip_safe=False,
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import pytest

from addonpayments.api.tests.conftest import BaseTest
from addonpayments.api.card_storage.requests import (ReceiptInRequest, CardUpdateRequest, CardNewRequest,
CardCancelRequest, CardDccRateRequest, PayerNewRequest,
RealVaultThreeDsVerifyEnrolled, PayerEditRequest,
AuthRequestWithRecurring)
from addonpayments.api.client import ApiClient
from tests.conftest import BaseTest


class TestCardStorage(BaseTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import pytest

from addonpayments.api.tests.conftest import BaseTest
from addonpayments.api.client import ApiClient
from addonpayments.api.dcc.requests import DccRate, AuthRequestWithDccInfo
from tests.conftest import BaseTest


class TestDcc(BaseTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from __future__ import absolute_import, unicode_literals

from addonpayments.api.tests.conftest import BaseTest
from addonpayments.api.client import ApiClient
from addonpayments.api.payment.requests import AuthRequest
from tests.conftest import BaseTest


class TestPayment(BaseTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import pytest

from addonpayments.api.tests.conftest import BaseTest
from addonpayments.api.client import ApiClient
from addonpayments.api.three_ds.requests import ThreeDsVerifyEnrolled, ThreeDsVerifySig, AuthRequestWithThreeDS
from tests.conftest import BaseTest


class TestThreeDs(BaseTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import pytest

from addonpayments.api.tests.conftest import BaseTest
from addonpayments.api.client import ApiClient
from addonpayments.api.payment.requests import AuthRequest
from addonpayments.api.transaction_management.requests import Settle, Rebate, Void
from tests.conftest import BaseTest


class TestTransactionManagement(BaseTest):
Expand Down
64 changes: 64 additions & 0 deletions addonpayments/api/tests/conftest.py → tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,77 @@

from __future__ import absolute_import, unicode_literals

import codecs
import pytest

from decouple import config

from addonpayments.hpp.card_storage.requests import CardStorageRequest
from addonpayments.hpp.payment.requests import PaymentRequest
from addonpayments.hpp.utils import JsonUtils
from tests.hpp.utils import get_sample_path, only_mandatory_hpp_request, hpp_request_storage_enabled

from addonpayments.api.elements import (Cvn, CardWithCvn, Recurring, Mpi, DccInfoWithAmount, PaymentData, CardWithRef,
CardRef, DccInfo, DccInfoWithRateType, Address, PhoneNumbers, Payer, Card)


@pytest.fixture()
def valid_hpp_request():
data = only_mandatory_hpp_request()
yield PaymentRequest(**data)


@pytest.fixture()
def valid_hpp_request_storage_enabled():
data = hpp_request_storage_enabled()
yield CardStorageRequest(**data)


@pytest.fixture()
def json_hpp_payment_request_valid():
path = get_sample_path('samples/hpp_payment_request.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', False)


@pytest.fixture()
def json_hpp_payment_request_supplementary_data():
path = get_sample_path('samples/hpp_payment_request_supplementary_data.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', False)


@pytest.fixture()
def json_hpp_payment_request_encoded():
path = get_sample_path('samples/hpp_payment_request_encoded.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', True)


@pytest.fixture()
def json_hpp_card_storage_request_valid():
path = get_sample_path('samples/hpp_card_storage_request.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', False)


@pytest.fixture()
def json_hpp_card_storage_request_supp_data():
path = get_sample_path('samples/hpp_card_storage_request_supplementary_data.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', False)


@pytest.fixture()
def json_hpp_card_storage_request_encoded():
path = get_sample_path('samples/hpp_card_storage_request_encoded.json')
with codecs.open(path, 'r', encoding='utf-8') as data_file:
yield JsonUtils.from_json_hpp_request(data_file.read(), 'utf-8', True)


###


class BaseTest(object):
"""
This class defines the static variables used in all tests
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1ea1cde

Please sign in to comment.