from ..code_registry import MethodCode, MessageType
from ..coap import Coap

def test_build_message():
    c = Coap('coap.me')
    result = c.get('hello')
    print str(bytearray(result.server_reply_list[0].payload))
    c.destroy()


from ..code_registry import MethodCode, MessageType
from ..coap import Coap
import binascii

def test_build_message():
    c = Coap('coap.me')
    result1 = c.get('hello')
    assert str(bytearray(result1.server_reply_list[0].payload)) == '\xffworld'

    result2 = c.get('separate')
    assert str(bytearray(result2.server_reply_list[0].payload)) == '\xffThat took a long time'

    c.destroy()


Add very basic testing for Coap request.
Add very basic testing for Coap request.

  from ..code_registry import MethodCode, MessageType
  from ..coap import Coap
+ import binascii
  
  def test_build_message():
      c = Coap('coap.me')
-     result = c.get('hello')
+     result1 = c.get('hello')
-     print str(bytearray(result.server_reply_list[0].payload))
+     assert str(bytearray(result1.server_reply_list[0].payload)) == '\xffworld'
+ 
+     result2 = c.get('separate')
+     assert str(bytearray(result2.server_reply_list[0].payload)) == '\xffThat took a long time'
+ 
      c.destroy()
  
  
Add very basic testing for Coap request.
## Code Before:
from ..code_registry import MethodCode, MessageType
from ..coap import Coap

def test_build_message():
    c = Coap('coap.me')
    result = c.get('hello')
    print str(bytearray(result.server_reply_list[0].payload))
    c.destroy()


## Instruction:
Add very basic testing for Coap request.
## Code After:
from ..code_registry import MethodCode, MessageType
from ..coap import Coap
import binascii

def test_build_message():
    c = Coap('coap.me')
    result1 = c.get('hello')
    assert str(bytearray(result1.server_reply_list[0].payload)) == '\xffworld'

    result2 = c.get('separate')
    assert str(bytearray(result2.server_reply_list[0].payload)) == '\xffThat took a long time'

    c.destroy()

