Cleanup tag escape testing.
This commit is contained in:
parent
f7bd9f9f68
commit
747563e4ff
@ -1,10 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
from jinja2 import Template
|
||||
|
||||
from xml.sax.saxutils import escape
|
||||
from moto.core.responses import BaseResponse
|
||||
from moto.ec2.models import validate_resource_ids
|
||||
from moto.ec2.utils import sequence_from_querystring, tags_from_query_string, filters_from_querystring
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
|
||||
class TagResponse(BaseResponse):
|
||||
@ -29,7 +28,7 @@ class TagResponse(BaseResponse):
|
||||
tags = self.ec2_backend.describe_tags(filters=filters)
|
||||
for tag in tags:
|
||||
tag['value'] = escape(tag['value'])
|
||||
template = Template(DESCRIBE_RESPONSE)
|
||||
template = self.response_template(DESCRIBE_RESPONSE)
|
||||
return template.render(tags=tags)
|
||||
|
||||
|
||||
|
@ -44,6 +44,7 @@ def test_remove_tag():
|
||||
conn.get_all_tags().should.have.length_of(1)
|
||||
instance.remove_tag("a key", "some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_get_all_tags():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
@ -58,6 +59,20 @@ def test_get_all_tags():
|
||||
tag.value.should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_get_all_tags_with_special_characters():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
instance = reservation.instances[0]
|
||||
|
||||
instance.add_tag("a key", "some<> value")
|
||||
|
||||
tags = conn.get_all_tags()
|
||||
tag = tags[0]
|
||||
tag.name.should.equal("a key")
|
||||
tag.value.should.equal("some<> value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_tags():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
Loading…
Reference in New Issue
Block a user