Beispiel #1
0
    def test_all_providers(self, mock_provider, monkeypatch):
        """Test ``all_providers()`` helper function"""
        def mock_providers():
            return ["mock"]

        monkeypatch.setattr(notifiers, "all_providers", mock_providers)

        assert "mock" in notifiers.all_providers()
Beispiel #2
0
    def test_all_providers(self, mock_provider, monkeypatch):
        """Test ``all_providers()`` helper function"""
        def mock_providers():
            return ['mock']

        monkeypatch.setattr(notifiers, 'all_providers', mock_providers)

        assert 'mock' in notifiers.all_providers()
Beispiel #3
0

def get_coin(coin, xpub=None):
    coin = coin.lower()
    if coin not in cryptos:
        raise HTTPException(422, "Unsupported currency")
    if not xpub:
        return cryptos[coin]
    return COINS[coin.upper()](xpub=xpub,
                               **crypto_settings[coin]["credentials"])


# cache notifiers schema

notifiers = {}
for provider in all_providers():
    notifier = get_notifier(provider)
    properties = parse_notifier_schema(notifier.schema)
    required = []
    if "required" in notifier.required:
        required = notifier.required["required"]
        if "message" in required:
            required.remove("message")
    notifiers[notifier.name] = {"properties": properties, "required": required}

# initialize redis pool
loop = asyncio.get_event_loop()
redis_pool = None


async def init_redis():
Beispiel #4
0
 def test_all_providers(self, mock_provider):
     from notifiers import all_providers
     assert 'mock' in all_providers()