示例#1
0
 def test_description(self):
     CategoryFactory.create()
     data = {
         'properties': {
             'key_1': 1,
             'key_2': 'value'
         },
         'meta': {
             'category': {
                 'id': 1,
             }
         },
         'media': [{
             'file_type': 'ImageFile',
             'name': 'Image',
             'description': None,
             'url': '/media/image.png',
             'thumbnail_url': '/media/image-thumbnail.png'
         }, {
             'file_type': 'VideoFile',
             'name': 'Video',
             'description': None,
             'url': 'https://www.youtube.com/watch?v=LueGR1IpfS0',
             'thumbnail_url': '/static/img/play.png'
         }, {
             'file_type': 'AudioFile',
             'name': 'Audio',
             'description': 'New feature - audio support.',
             'url': '/media/audio.mp4',
             'thumbnail_url': None
         }],
         'comments': [{
             'text':
             'Is it ready yet?',
             'creator': {
                 'display_name': 'Adam'
             },
             'responses': [{
                 'text': 'Yes!',
                 'creator': {
                     'display_name': 'Sarah'
                 },
                 'responses': []
             }]
         }]
     }
     description = kml_tags.kml_desc(data)
     self.assertEqual(
         description, '<![CDATA[<table><tr><td>key_1</td><td>1</td></tr>'
         '<tr><td>key_2</td><td>value</td></tr></table>'
         '<table><tr><td><strong>Image</strong><br /><a href="/media/image.png"><img src="/media/image-thumbnail.png" /></a></td></tr>'
         '<tr><td><strong>Video</strong><br /><a href="https://www.youtube.com/watch?v=LueGR1IpfS0"><img src="/static/img/play.png" /></a></td></tr>'
         '<tr><td><a href="/media/audio.mp4"><strong>Audio</strong></a><br />New feature - audio support.</td></tr></table>'
         '<table><tr><td><strong>Adam</strong><br />Is it ready yet?'
         '<table><tr><td><strong>Sarah</strong><br />Yes!</td></tr></table></td></tr></table>]]>'
     )
示例#2
0
 def test_description(self):
     data = {
         'properties': {
             'key_1': 1,
             'key_2': 'value'
         }
     }
     description = kml_tags.kml_desc(data)
     self.assertEqual(
         description,
         '<![CDATA[<table><tr><td>key_1</td><td>1</td></tr>'
         '<tr><td>key_2</td><td>value</td></tr></table>]]>'
     )
示例#3
0
 def test_description(self):
     category = CategoryFactory.create()
     data = {
         'properties': {
             'key_1': 1,
             'key_2': 'value'
         },
         'meta': {
             'category': {
                 'id': 1,
             }
         }
     }
     description = kml_tags.kml_desc(data)
     self.assertEqual(
         description,
         '<![CDATA[<table><tr><td>key_1</td><td>1</td></tr>'
         '<tr><td>key_2</td><td>value</td></tr></table>]]>'
     )
示例#4
0
 def test_description(self):
     CategoryFactory.create()
     data = {
         'properties': {
             'key_1': 1,
             'key_2': 'value'
         },
         'meta': {
             'category': {
                 'id': 1,
             }
         },
         'media': [
             {
                 'file_type': 'ImageFile',
                 'name': 'Image',
                 'description': None,
                 'url': '/media/image.png',
                 'thumbnail_url': '/media/image-thumbnail.png'
             },
             {
                 'file_type': 'VideoFile',
                 'name': 'Video',
                 'description': None,
                 'url': 'https://www.youtube.com/watch?v=LueGR1IpfS0',
                 'thumbnail_url': '/static/img/play.png'
             },
             {
                 'file_type': 'AudioFile',
                 'name': 'Audio',
                 'description': 'New feature - audio support.',
                 'url': '/media/audio.mp4',
                 'thumbnail_url': None
             }
         ],
         'comments': [
             {
                 'text': 'Is it ready yet?',
                 'creator': {
                     'display_name': 'Adam'
                 },
                 'responses': [
                     {
                         'text': 'Yes!',
                         'creator': {
                             'display_name': 'Sarah'
                         },
                         'responses': []
                     }
                 ]
             }
         ]
     }
     description = kml_tags.kml_desc(data)
     self.assertEqual(
         description,
         '<![CDATA[<table><tr><td>key_1</td><td>1</td></tr>'
         '<tr><td>key_2</td><td>value</td></tr></table>'
         '<table><tr><td><strong>Image</strong><br /><a href="/media/image.png"><img src="/media/image-thumbnail.png" /></a></td></tr>'
         '<tr><td><strong>Video</strong><br /><a href="https://www.youtube.com/watch?v=LueGR1IpfS0"><img src="/static/img/play.png" /></a></td></tr>'
         '<tr><td><a href="/media/audio.mp4"><strong>Audio</strong></a><br />New feature - audio support.</td></tr></table>'
         '<table><tr><td><strong>Adam</strong><br />Is it ready yet?'
         '<table><tr><td><strong>Sarah</strong><br />Yes!</td></tr></table></td></tr></table>]]>'
     )
示例#5
0
 def test_description(self):
     data = {'properties': {'key_1': 1, 'key_2': 'value'}}
     description = kml_tags.kml_desc(data)
     self.assertEqual(
         description, '<![CDATA[<table><tr><td>key_1</td><td>1</td></tr>'
         '<tr><td>key_2</td><td>value</td></tr></table>]]>')