def test_recieve(_fixture):
    client = Client("reciever")
    msgs = client.get_next_messages()
    for msg in msgs:
        assert isinstance(msg, bytes)
        assert msg == _fixture.msg.contentdata
Exemplo n.º 2
0
from iofog.microservices.client import Client
from iofog.microservices.exception import IoFogException
from iofog.microservices.iomessage import IoMessage
from iofog.microservices.listener import *

import threading
import os
import shutil
from apscheduler.schedulers.blocking import BlockingScheduler

lock = threading.Lock()
current_config = None
path = os.environ['MODELS_PATH']

try:
    client = Client()
except IoFogException as e:
    print(e)


def update_config():
    attempt_limit = 5
    config = None

    while attempt_limit > 0:
        try:
            config = client.get_config()
            break
        except IoFogException as ex:
            attempt_limit -= 1
            print(ex)
def test_send(_fixture):
    client = Client("sender")
    receipt = client.post_message(_fixture.msg)
    assert isinstance(receipt, dict)