コード例 #1
0
ファイル: test_umlauts.py プロジェクト: RDXT/pymill
def test_umlaut_new_client_description():
    """
    Tests umlaut on description string.
    """
    pm = MockPymill('key')
    pm.new_client(email="*****@*****.**", description='Ümläüt')
    assert pm.api_called
    assert pm.call_args['params'].get('description') == 'Ümläüt'
コード例 #2
0
ファイル: test_umlauts.py プロジェクト: cruncher/pymill
def test_umlaut_new_client_description():
    """
    Tests umlaut on description string.
    """
    pm = MockPymill('key')
    pm.new_client(email="*****@*****.**", description='Ümläüt')
    assert pm.api_called
    assert pm.call_args['params'].get('description') == 'Ümläüt'
コード例 #3
0
ファイル: test_umlauts.py プロジェクト: RDXT/pymill
def test_umlaut_update_client_description():
    """
    Tests umlaut on description string.
    """
    pm = MockPymill('key')
    clientid = "client_12345"
    pm.update_client(client_id = clientid, email="*****@*****.**", description='Ümläüt')
    assert pm.api_called
    assert pm.call_args['params'].get('description') == 'Ümläüt'
コード例 #4
0
ファイル: test_umlauts.py プロジェクト: cruncher/pymill
def test_umlaut_update_client_description():
    """
    Tests umlaut on description string.
    """
    pm = MockPymill('key')
    clientid = "client_12345"
    pm.update_client(client_id=clientid,
                     email="*****@*****.**",
                     description='Ümläüt')
    assert pm.api_called
    assert pm.call_args['params'].get('description') == 'Ümläüt'
コード例 #5
0
ファイル: test_transactions.py プロジェクト: RDXT/pymill
def test_transact_requirements_with_preauth():
    """
    Required parameters:

    * preauth
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(preauth="preauth", amount=123, currency='EUR')
    assert pm.api_called
    assert pm.call_args['params'].get('preauthorization') == 'preauth'
コード例 #6
0
ファイル: test_transactions.py プロジェクト: flegoff/pymill
def test_transact_requirements_with_preauth():
    """
    Required parameters:

    * preauth
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(preauth="preauth", amount=123, currency='EUR')
    assert pm.api_called
    assert pm.call_args['params'].get('preauthorization') == 'preauth'
コード例 #7
0
def test_offer_intervals():
    """
    Tests for correct intervals.

    From API documentation:
    ``Format: number DAY|WEEK|MONTH|YEAR Example: 2 DAY``
    """
    params = {'amount': 100, 'currency': 'EUR', 'name': "NAME"}

    pm = MockPymill('key')
    for value in ('month', '1 year', '10 day', '2 week'):
        pm.new_offer(interval=value, **params)
        assert pm.api_called
        assert pm.call_args['params'].get('interval') == value
コード例 #8
0
ファイル: test_offers.py プロジェクト: antialiasis/pymill
def test_offer_intervals():
    """
    Tests for correct intervals.

    From API documentation:
    ``Format: number DAY|WEEK|MONTH|YEAR Example: 2 DAY``
    """
    params = {'amount': 100, 'currency': 'EUR', 'name': "NAME"}

    pm = MockPymill('key')
    for value in ('month', '1 year', '10 day', '2 week'):
        pm.new_offer(interval=value, **params)
        assert pm.api_called
        assert pm.call_args['params'].get('interval') == value
コード例 #9
0
ファイル: test_transactions.py プロジェクト: RDXT/pymill
def test_transact_requirements_with_token():
    """
    Tests that all requirement checks work for calls using a token. In this
    case following parameters have to be passed in order to create a
    transaction:

    * token
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(token="token", amount=123, currency='EUR')
    assert pm.api_called
    assert pm.call_args['params'].get('token') == 'token'
コード例 #10
0
ファイル: test_transactions.py プロジェクト: flegoff/pymill
def test_transact_requirements_with_token():
    """
    Tests that all requirement checks work for calls using a token. In this
    case following parameters have to be passed in order to create a
    transaction:

    * token
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(token="token", amount=123, currency='EUR')
    assert pm.api_called
    assert pm.call_args['params'].get('token') == 'token'
コード例 #11
0
def test_offer_requirements():
    """
    Tests that all requirement checks work creation of offers.
    Following parameters have to be passed in order to create an offer:

    * amount
    * interval
    * currency
    * name
    """
    pm = MockPymill('key')
    pm.new_offer(interval="1 month", amount=123, currency='EUR', name="NAME")
    assert pm.api_called
    assert pm.call_args['params'].get('interval') == '1 month'
    assert pm.call_args['params'].get('amount') == '123'
    assert pm.call_args['params'].get('currency') == "EUR"
コード例 #12
0
ファイル: test_offers.py プロジェクト: antialiasis/pymill
def test_offer_requirements():
    """
    Tests that all requirement checks work creation of offers.
    Following parameters have to be passed in order to create an offer:

    * amount
    * interval
    * currency
    * name
    """
    pm = MockPymill('key')
    pm.new_offer(interval="1 month", amount=123, currency='EUR', name="NAME")
    assert pm.api_called
    assert pm.call_args['params'].get('interval') == '1 month'
    assert pm.call_args['params'].get('amount') == '123'
    assert pm.call_args['params'].get('currency') == "EUR"
コード例 #13
0
def test_offer_amount():
    """
    Tests that amount raises ValueErrors on false parameters.
    """
    params = {'interval': "1 month", 'currency': 'EUR', 'name': "NAME"}

    pm = MockPymill('key')
    with pytest.raises(OfferException):
        pm.new_offer(amount='X', **params)
    with pytest.raises(OfferException):
        pm.new_offer(amount='10.1', **params)

    # FIXME: should raise an exception, too?
    pm.new_offer(amount=0, **params)
    assert pm.api_called == False

    # with correct value
    pm.new_offer(amount="100", **params)
    assert pm.api_called
    assert pm.call_args['params'].get('amount') == '100'
コード例 #14
0
ファイル: test_offers.py プロジェクト: antialiasis/pymill
def test_offer_amount():
    """
    Tests that amount raises ValueErrors on false parameters.
    """
    params = {'interval': "1 month", 'currency': 'EUR', 'name': "NAME"}

    pm = MockPymill('key')
    with pytest.raises(ValueError):
        pm.new_offer(amount='X', **params)
    with pytest.raises(ValueError):
        pm.new_offer(amount='10.1', **params)

    # FIXME: should raise an exception, too?
    pm.new_offer(amount=0, **params)
    assert pm.api_called == False

    # with correct value
    pm.new_offer(amount="100", **params)
    assert pm.api_called
    assert pm.call_args['params'].get('amount') == '100'
コード例 #15
0
ファイル: test_transactions.py プロジェクト: flegoff/pymill
def test_transact_requirements_with_payment():
    """
    Required parameters:

    * payment (or account, code, holder, client)
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(payment='payment', amount=123, currency='EUR')
    assert pm.api_called

    pm = MockPymill('key')
    pm.transact(code='code',
                account='account',
                client='client',
                holder='holder',
                amount=123,
                currency='EUR')
    assert pm.api_called
コード例 #16
0
ファイル: test_transactions.py プロジェクト: RDXT/pymill
def test_transact_requirements_with_payment():
    """
    Required parameters:

    * payment (or account, code, holder, client)
    * amount
    * currency
    """
    pm = MockPymill('key')
    pm.transact(payment='payment', amount=123, currency='EUR')
    assert pm.api_called

    pm = MockPymill('key')
    pm.transact(code='code', account='account', client='client',
                holder='holder', amount=123, currency='EUR')
    assert pm.api_called