Beispiel #1
0
    def test_widget_html(self):
        expected = (
            '<div class="s3direct" data-policy-url="/get_upload_params/" '
            'data-signing-url="/get_aws_v4_signature/">\n'
            '  <a class="file-link" target="_blank" href=""></a>\n'
            '  <a class="file-remove" href="#remove">Remove</a>\n'
            '  <input class="csrf-cookie-name" type="hidden" value="csrftoken">\n'
            '  <input class="file-url" type="hidden" value="" id="" name="filename" />'
            '\n'
            '  <input class="file-dest" type="hidden" value="foo">\n'
            '  <input class="file-input" type="file"  style=""/>\n'
            '  <div class="progress progress-striped active">\n'
            '    <div class="bar"></div>\n'
            '  </div>\n'
            '</div>\n')

        widget = widgets.S3DirectWidget(dest='foo')
        self.assertEqual(widget.render('filename', None), expected)
Beispiel #2
0
 def test_widget_html(self):
     widget = widgets.S3DirectWidget(dest='foo')
     self.assertEqual(widget.render('filename', None), HTML_OUTPUT)
Beispiel #3
0
 def test_widget_default_upload_to_html(self):
     widget = widgets.S3DirectWidget()
     html = HTML_OUTPUT.replace('foo', 's3direct')
     self.assertEqual(widget.render('filename', None), html)