def test_topics_to_bytes_with_uuid(uuid): """ Test topics_to_bytes basic usage, specifying different uuid's. """ handlers = {'topic_one': 'handler', b'topic_two': 'handler'} curated = topics_to_bytes(handlers, uuid=uuid) assert isinstance(curated, dict) for k, v in curated.items(): assert isinstance(k, bytes) assert k.startswith(uuid + b'topic_') assert v == 'handler'
def test_topics_to_bytes_without_uuid(): """ Test topics_to_bytes basic usage, without specifying a uuid. """ handlers = {'topic_one': 'handler', b'topic_two': 'handler'} curated = topics_to_bytes(handlers) assert isinstance(curated, dict) for k, v in curated.items(): assert isinstance(k, bytes) assert k.startswith(b'topic_') assert v == 'handler'