Esempio n. 1
0
    def ready(self):
        from polaris.integrations import register_integrations
        from .integrations import (
            MyDepositIntegration,
            MyWithdrawalIntegration,
            MyCustomerIntegration,
            MySEP31ReceiverIntegration,
            MyRailsIntegration,
            toml_integration,
            scripts_integration,
            fee_integration,
            info_integration,
        )

        register_integrations(
            deposit=MyDepositIntegration(),
            withdrawal=MyWithdrawalIntegration(),
            toml=toml_integration,
            scripts=scripts_integration,
            fee=fee_integration,
            sep6_info=info_integration,
            customer=MyCustomerIntegration(),
            sep31_receiver=MySEP31ReceiverIntegration(),
            rails=MyRailsIntegration(),
        )
def test_init_success_all_integrations():
    deposit = DepositIntegration()
    withdrawal = WithdrawalIntegration()
    sep31 = SEP31ReceiverIntegration()
    customer = CustomerIntegration()
    rails = RailsIntegration()
    callable = lambda x: None
    register_integrations(
        deposit=deposit,
        withdrawal=withdrawal,
        sep31_receiver=sep31,
        customer=customer,
        rails=rails,
        fee=callable,
        scripts=callable,
        sep6_info=callable,
        toml=callable,
    )
    assert integrations.registered_deposit_integration == deposit
    assert integrations.registered_withdrawal_integration == withdrawal
    assert integrations.registered_sep31_receiver_integration == sep31
    assert integrations.registered_customer_integration == customer
    assert integrations.registered_rails_integration == rails
    assert all(i == callable for i in [
        integrations.registered_fee_func,
        integrations.registered_info_func,
        integrations.registered_toml_func,
        integrations.registered_scripts_func,
    ])
Esempio n. 3
0
    def ready(self):
        from polaris.integrations import register_integrations
        from .integrations import (MyDepositIntegration,
                                   MyWithdrawalIntegration,
                                   get_stellar_toml)

        register_integrations(
            deposit=MyDepositIntegration(),
            withdrawal=MyWithdrawalIntegration(),
            toml_func=get_stellar_toml
        )
def test_invalid_integration_params():
    for kwarg in [
            "deposit",
            "withdrawal",
            "sep31_receiver",
            "customer",
            "rails",
            "fee",
            "scripts",
            "sep6_info",
            "toml",
    ]:
        with pytest.raises(TypeError):
            register_integrations(**{kwarg: NonCallableMock()})
Esempio n. 5
0
    def ready(self):
        from polaris.integrations import register_integrations
        from .integrations import (
            MyDepositIntegration,
            MyWithdrawalIntegration,
            get_stellar_toml,
            scripts,
            calculate_custom_fee,
        )

        register_integrations(
            deposit=MyDepositIntegration(),
            withdrawal=MyWithdrawalIntegration(),
            toml_func=get_stellar_toml,
            scripts_func=scripts,
            fee_func=calculate_custom_fee,
        )
Esempio n. 6
0
def test_register_integrations_classes():
    tdi, twi = TestDepositIntegration(), TestWithdrawalIntegration()
    integrations.register_integrations(deposit=tdi, withdrawal=twi)
    assert integrations.registered_deposit_integration == tdi
    assert integrations.registered_withdrawal_integration == twi
Esempio n. 7
0
    def ready(self):
        from polaris.integrations import register_integrations
        from .integrations import MyDepositIntegration, MyWithdrawalIntegration

        register_integrations(deposit=MyDepositIntegration(),
                              withdrawal=MyWithdrawalIntegration())
def test_init_success_no_integrations():
    register_integrations()