blob: 9fa65d0c957ce557f9dc504ce497c462936c5b88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import json
import unittest
import swiftstory.status as Status
class TestStatus(unittest.TestCase):
def test_error(self):
error_text = "Some error with utf-8 characters ùðú!"
error_code = 520
output = json.loads(Status.error(error_text, error_code))
self.assertEqual(output["type"], "response")
self.assertEqual(output["content"]["info"], error_text)
self.assertEqual(output["content"]["status"], error_code)
def test_success(self):
text = "Some message with utf-8 characters ùðú!"
output = json.loads(Status.success(text))
self.assertEqual(output["type"], "response")
self.assertEqual(output["content"]["status"], 0)
self.assertEqual(output["content"]["result"], text)
|