def assert_code(response, status_code, msg_prefix=u''):
 if msg_prefix:
  msg_prefix = (u'%s: ' % msg_prefix)
 assert (response.status_code == status_code), (u'Response code was %d (expected %d)' % (response.status_code, status_code))

def assert_code ( response , status_code , msg_prefix = u'' ) : if msg_prefix : msg_prefix = ( u'%s: ' % msg_prefix ) assert ( response . status_code == status_code ) , ( u'Response code was %d (expected %d)' % ( response . status_code , status_code ) )
asserts the response was returned with the given status code .