parent
0211e9d78d
commit
c9dd9cc7f9
8 changed files with 120 additions and 13 deletions
|
|
@ -1,5 +1,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from six.moves.urllib.parse import quote
|
||||
|
||||
import pytest
|
||||
import sure # noqa
|
||||
|
||||
import moto.server as server
|
||||
|
|
@ -19,3 +22,22 @@ def test_iotdata_list():
|
|||
thing_name = "nothing"
|
||||
res = test_client.get("/things/{}/shadow".format(thing_name))
|
||||
res.status_code.should.equal(404)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url_encode_topic",
|
||||
[
|
||||
pytest.param(True, id="Topic in Path is URL encoded"),
|
||||
pytest.param(False, id="Topic in Path is *not* URL encoded"),
|
||||
],
|
||||
)
|
||||
@mock_iotdata
|
||||
def test_publish(url_encode_topic):
|
||||
backend = server.create_backend_app("iot-data")
|
||||
test_client = backend.test_client()
|
||||
|
||||
topic = "test/topic"
|
||||
topic_for_path = quote(topic, safe="") if url_encode_topic else topic
|
||||
|
||||
result = test_client.post("/topics/{}".format(topic_for_path))
|
||||
result.status_code.should.equal(200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue