Revision 19d0725a snf-cyclades-app/synnefo/api/tests/ports.py
b/snf-cyclades-app/synnefo/api/tests/ports.py | ||
---|---|---|
84 | 84 |
def test_update_port_name(self): |
85 | 85 |
nic = dbmf.NetworkInterfaceFactory(device_owner='vm') |
86 | 86 |
url = join_urls(PORTS_URL, str(nic.id)) |
87 |
request = {'port': {"name": "test-name"}}
|
|
87 |
request = {'port': {"name": u"test-name\u2601\u2602"}}
|
|
88 | 88 |
response = self.put(url, params=json.dumps(request), |
89 | 89 |
user=nic.userid) |
90 | 90 |
self.assertEqual(response.status_code, 200) |
91 | 91 |
res = json.loads(response.content) |
92 |
self.assertEqual(res['port']['name'], "test-name") |
|
93 |
|
|
94 |
# def test_update_port_sg_unfound(self): |
|
95 |
# sg1 = dbmf.SecurityGroupFactory() |
|
96 |
# nic = dbmf.NetworkInterfaceFactory(device_owner='vm') |
|
97 |
# nic.security_groups.add(sg1) |
|
98 |
# nic.save() |
|
99 |
# url = join_urls(PORTS_URL, str(nic.id)) |
|
100 |
# request = {'port': {"security_groups": ["123"]}} |
|
101 |
# response = self.put(url, params=json.dumps(request), |
|
102 |
# user=nic.userid) |
|
103 |
# self.assertEqual(response.status_code, 404) |
|
104 |
|
|
105 |
# def test_update_port_sg(self): |
|
106 |
# sg1 = dbmf.SecurityGroupFactory() |
|
107 |
# sg2 = dbmf.SecurityGroupFactory() |
|
108 |
# sg3 = dbmf.SecurityGroupFactory() |
|
109 |
# nic = dbmf.NetworkInterfaceFactory(device_owner='vm') |
|
110 |
# nic.security_groups.add(sg1) |
|
111 |
# nic.save() |
|
112 |
# url = join_urls(PORTS_URL, str(nic.id)) |
|
113 |
# request = {'port': {"security_groups": [str(sg2.id), str(sg3.id)]}} |
|
114 |
# response = self.put(url, params=json.dumps(request), |
|
115 |
# user=nic.userid) |
|
116 |
# res = json.loads(response.content) |
|
117 |
# self.assertEqual(res['port']['security_groups'], |
|
118 |
# [str(sg2.id), str(sg3.id)]) |
|
92 |
self.assertEqual(res['port']['name'], |
|
93 |
u"test-name\u2601\u2602") |
|
119 | 94 |
|
120 | 95 |
def test_create_port_invalid(self): |
121 | 96 |
# No network |
... | ... | |
133 | 108 |
"port": { |
134 | 109 |
"name": "port1", |
135 | 110 |
"network_id": net.id, |
136 |
"fixed_ips": ["lala"]
|
|
111 |
"fixed_ips": [u"lala\u2608"]
|
|
137 | 112 |
} |
138 | 113 |
} |
139 | 114 |
response = self.post(PORTS_URL, params=json.dumps(request)) |
... | ... | |
170 | 145 |
vm = dbmf.VirtualMachineFactory(userid=net.userid) |
171 | 146 |
request = { |
172 | 147 |
"port": { |
173 |
"name": "port1",
|
|
148 |
"name": u"Port in the \u2601",
|
|
174 | 149 |
"network_id": str(net.id), |
175 | 150 |
"device_id": str(vm.id), |
176 | 151 |
} |
... | ... | |
184 | 159 |
vm = dbmf.VirtualMachineFactory(userid=net.userid) |
185 | 160 |
request = { |
186 | 161 |
"port": { |
187 |
"name": "port1",
|
|
162 |
"name": u"Port in the \u2601",
|
|
188 | 163 |
"network_id": str(net.id), |
189 | 164 |
"device_id": str(vm.id), |
190 | 165 |
"fixed_ips": [{"ip_address": "8.8.8.8"}] |
... | ... | |
233 | 208 |
userid=vm.userid) |
234 | 209 |
request = { |
235 | 210 |
"port": { |
236 |
"name": "port1",
|
|
211 |
"name": "Port in the \u2601",
|
|
237 | 212 |
"network_id": str(fip.network_id), |
238 | 213 |
"device_id": str(vm.id), |
239 | 214 |
"fixed_ips": [{"ip_address": fip.address}] |
Also available in: Unified diff