def test_err_with_array_of_strings(self): """ Testcase with simple array of string. """ status = Status.err(["Hello World", "Bye"]) string = '{"status": "err", "payload": ["Hello World", "Bye"],\ "uuid": "' + status.uuid + '"}' status_string = Status.from_json(string) status_new = Status.from_json(status.to_json()) self.assertEqual(status, status_string) self.assertEqual(status, status_new) self.assertEqual(status_string, status_new)
def test_err_with_string(self): """ Testcase with simple string. """ status = Status.err("Hello World") string = '{"status": "err", "payload": "Hello World", \ "uuid": "' + status.uuid + '"}' status_string = Status.from_json(string) status_new = Status.from_json(status.to_json()) self.assertEqual(status, status_string) self.assertEqual(status, status_new) self.assertEqual(status_string, status_new)
def test_ok_with_array_of_integer(self): """ Testcase with simple array of integer. """ status = Status.ok([0, 1, 2, 3]) string = '{"status": "ok", "payload": [0, 1, 2, 3],\ "uuid": "' + status.uuid + '"}' status_string = Status.from_json(string) status_new = Status.from_json(status.to_json()) self.assertEqual(status, status_string) self.assertEqual(status, status_new) self.assertEqual(status_string, status_new)
def test_ok_with_map_mixed(self): """ Testcase with map with mixed objects. """ status = Status.ok({"Hello World": "Bye", "Integer": 0}) string = '{"status": "ok", "payload": \ {"Hello World": "Bye", "Integer": 0}, \ "uuid": "' + status.uuid + '"}' status_string = Status.from_json(string) status_new = Status.from_json(status.to_json()) self.assertEqual(status, status_string) self.assertEqual(status, status_new) self.assertEqual(status_string, status_new)