forked from nbialostosky/sample-python-cfd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_menu_controller.py
More file actions
76 lines (63 loc) · 2.04 KB
/
test_menu_controller.py
File metadata and controls
76 lines (63 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# coding: utf-8
from __future__ import absolute_import
import unittest
from flask import json
from six import BytesIO
from openapi_server.models.error import Error # noqa: E501
from openapi_server.models.menu_item import MenuItem # noqa: E501
from openapi_server.test import BaseTestCase
class TestMenuController(BaseTestCase):
"""MenuController integration test stubs"""
def test_add_menu_item(self):
"""Test case for add_menu_item
Create a menu item
"""
menu_item = {
"price": 6.02,
"imageId": 5,
"name": "name",
"description": "description",
"id": 13,
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
response = self.client.open(
"/CFD/1.0.0/menu",
method="POST",
headers=headers,
data=json.dumps(menu_item),
content_type="application/json",
)
self.assertStatus(
response, 204, "Response body is : " + response.data.decode("utf-8")
)
def test_list_menu(self):
"""Test case for list_menu
List all menu items
"""
query_string = [("limit", 56)]
headers = {
"Accept": "application/json",
}
response = self.client.open(
"/CFD/1.0.0/menu",
method="GET",
headers=headers,
query_string=query_string,
)
self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
def test_show_menu_item_by_id(self):
"""Test case for show_menu_item_by_id
Info for a specific menu item
"""
headers = {
"Accept": "application/json",
}
response = self.client.open(
"/CFD/1.0.0/menu/{item_id}".format(item_id=0), method="GET", headers=headers
)
self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
if __name__ == "__main__":
unittest.main()