# Path: coolamqp/objects.py
# EMPTY_PROPERTIES = MessageProperties()
# def toutf8(q):
# def tobytes(q):
#     def __init__(self, oneshots=False):
#     def add(self, callable):
#     def __call__(self, *args, **kwargs):
#     def __init__(self, body,         # type: bytes
#                  properties=None     # type: tp.Optional[MessageProperties]
#                  ):
# def LAMBDA_NONE():
#     def __init__(self, body,  # type: tp.Union[str, bytes, bytearray, tp.List[memoryview]]
#                  exchange_name,  # type: memoryview
#                  routing_key,  # type: memoryview
#                  properties=None,
#                  delivery_tag=None,  # type: int
#                  ack=None,  # type: tp.Callable[[], None]
#                  nack=None  # type: tp.Callable[[], None]
#                  ):
#     def ack(self):
#     def nack(self):
#     def __init__(self, name=u'',  # type: tp.Union[str, bytes]
#                  type=b'direct',  # type: tp.Union[str, bytes]
#                  durable=True,  # type: bool
#                  auto_delete=False  # type: bool
#                  ):
#     def __repr__(self):  # type: () -> str
#     def __hash__(self):  # type: () -> int
#     def __eq__(self, other):  # type: (Exchange) -> bool
#     def __init__(self, name=b'',  # type: tp.Union[str, bytes]
#                  durable=False,  # type: bool
#                  exchange=None,  # type: tp.Optional[Exchange]
#                  exclusive=False,  # type: bool
#                  auto_delete=False  # type: bool
#                  ):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __init__(self, queue,   # type: tp.Union[Queue, bytes, unicode]
#                  exchange,      # type: tp.Union[Exchange, bytes, unicode]
#                  routing_key    # type: tp.Union[bytes, unicode]
#                  ):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):  # type: () -> str
# class Callable(object):
# class Message(object):
# class ReceivedMessage(Message):
# class Exchange(object):
# class Queue(object):
# class QueueBind(object):
# class NodeDefinition(object):


import unittest
from coolamqp.objects import NodeDefinition, MessageProperties
# coding=UTF-8
from __future__ import print_function, absolute_import, division




class TestObjects(unittest.TestCase):
    def test_message_properties(self):
        empty_p_msg = MessageProperties()
        ce_p_msg = MessageProperties(content_encoding=b'wtf')
        self.assertIn('wtf', str(ce_p_msg))

    def test_node_definition_from_amqp(self):
        n1 = NodeDefinition(u'amqp://ala:ma@kota/psa')

        self.assertEquals(n1.user, u'ala')
        self.assertEquals(n1.password, u'ma')
        self.assertEquals(n1.virtual_host, u'psa')
        self.assertEquals(n1.host, u'kota')


# Path: coolamqp/objects.py
# EMPTY_PROPERTIES = MessageProperties()
# def toutf8(q):
# def tobytes(q):
#     def __init__(self, oneshots=False):
#     def add(self, callable):
#     def __call__(self, *args, **kwargs):
#     def __init__(self, body,         # type: bytes
#                  properties=None     # type: tp.Optional[MessageProperties]
#                  ):
# def LAMBDA_NONE():
#     def __init__(self, body,  # type: tp.Union[str, bytes, bytearray, tp.List[memoryview]]
#                  exchange_name,  # type: memoryview
#                  routing_key,  # type: memoryview
#                  properties=None,
#                  delivery_tag=None,  # type: int
#                  ack=None,  # type: tp.Callable[[], None]
#                  nack=None  # type: tp.Callable[[], None]
#                  ):
#     def ack(self):
#     def nack(self):
#     def __init__(self, name=u'',  # type: tp.Union[str, bytes]
#                  type=b'direct',  # type: tp.Union[str, bytes]
#                  durable=True,  # type: bool
#                  auto_delete=False  # type: bool
#                  ):
#     def __repr__(self):  # type: () -> str
#     def __hash__(self):  # type: () -> int
#     def __eq__(self, other):  # type: (Exchange) -> bool
#     def __init__(self, name=b'',  # type: tp.Union[str, bytes]
#                  durable=False,  # type: bool
#                  exchange=None,  # type: tp.Optional[Exchange]
#                  exclusive=False,  # type: bool
#                  auto_delete=False  # type: bool
#                  ):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __init__(self, queue,   # type: tp.Union[Queue, bytes, unicode]
#                  exchange,      # type: tp.Union[Exchange, bytes, unicode]
#                  routing_key    # type: tp.Union[bytes, unicode]
#                  ):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):  # type: () -> str
# class Callable(object):
# class Message(object):
# class ReceivedMessage(Message):
# class Exchange(object):
# class Queue(object):
# class QueueBind(object):
# class NodeDefinition(object):


# Path: tests/test_objects.py
import unittest
from coolamqp.objects import NodeDefinition, MessageProperties

# coding=UTF-8
from __future__ import print_function, absolute_import, division




class TestObjects(unittest.TestCase):
    def test_message_properties(self):
        empty_p_msg = MessageProperties()
        ce_p_msg = MessageProperties(content_encoding=b'wtf')
        self.assertIn('wtf', str(ce_p_msg))

    def test_node_definition_from_amqp(self):
        n1 = NodeDefinition(u'amqp://ala:ma@kota/psa')

        self.assertEquals(n1.user, u'ala')
        self.assertEquals(n1.password, u'ma')
        self.assertEquals(n1.virtual_host, u'psa')
        self.assertEquals(n1.host, u'kota')


        n1 = NodeDefinition(u'amqp://ala:ma@kota/')