Ejemplo n.º 1
0
    def test_get_value(self):
        column = MultiMediaExportColumn(item=MultiMediaItem(path=[PathNode(name="form"), PathNode(name="photo")]))

        result = column.get_value("my-domain", "1234", {"photo": "1234.jpg"}, [PathNode(name="form")])
        self.assertEqual(
            result, "{}?attachment=1234.jpg".format(absolute_reverse("download_attachment", args=("my-domain", "1234")))
        )
        result = column.get_value("my-domain", "1234", {"photo": None}, [PathNode(name="form")])
        self.assertEqual(result, MISSING_VALUE)

        result = column.get_value("my-domain", "1234", {"photo": ""}, [PathNode(name="form")])
        self.assertEqual(result, "")
Ejemplo n.º 2
0
    def test_get_value(self):
        column = MultiMediaExportColumn(
            item=MultiMediaItem(
                path=[PathNode(name='form'), PathNode(name='photo')],
            ),
        )

        result = column.get_value('my-domain', '1234', {'photo': '1234.jpg'}, [PathNode(name='form')])
        self.assertEqual(
            result,
            absolute_reverse('api_form_attachment', args=('my-domain', '1234', '1234.jpg'))
        )
        result = column.get_value('my-domain', '1234', {'photo': None}, [PathNode(name='form')])
        self.assertEqual(result, MISSING_VALUE)

        result = column.get_value('my-domain', '1234', {'photo': ''}, [PathNode(name='form')])
        self.assertEqual(result, '')
Ejemplo n.º 3
0
    def test_get_value(self):
        column = MultiMediaExportColumn(item=MultiMediaItem(
            path=[PathNode(name='form'),
                  PathNode(name='photo')], ), )

        result = column.get_value('my-domain', '1234', {'photo': '1234.jpg'},
                                  [PathNode(name='form')])
        self.assertEqual(
            result, '{}?attachment=1234.jpg'.format(
                absolute_reverse('download_attachment',
                                 args=('my-domain', '1234'))))
Ejemplo n.º 4
0
    def test_get_value_excel_format(self):
        column = MultiMediaExportColumn(item=MultiMediaItem(path=[PathNode(name="form"), PathNode(name="photo")]))

        result = column.get_value(
            "my-domain", "1234", {"photo": "1234.jpg"}, [PathNode(name="form")], transform_dates=True
        )
        self.assertEqual(
            result,
            '=HYPERLINK("{}?attachment=1234.jpg")'.format(
                absolute_reverse("download_attachment", args=("my-domain", "1234"))
            ),
        )
Ejemplo n.º 5
0
    def test_get_value(self):
        column = MultiMediaExportColumn(
            item=MultiMediaItem(
                path=[PathNode(name='form'), PathNode(name='photo')],
            ),
        )

        result = column.get_value('my-domain', '1234', {'photo': '1234.jpg'}, [PathNode(name='form')])
        self.assertEqual(
            result,
            '{}?attachment=1234.jpg'.format(
                absolute_reverse('download_attachment', args=('my-domain', '1234'))
            )
        )
Ejemplo n.º 6
0
    def test_get_value_excel_format(self):
        column = MultiMediaExportColumn(item=MultiMediaItem(
            path=[PathNode(name='form'),
                  PathNode(name='photo')], ), )

        result = column.get_value(
            'my-domain',
            '1234',
            {'photo': '1234.jpg'},
            [PathNode(name='form')],
            transform_dates=True,
        )
        self.assertEqual(
            result, '=HYPERLINK("{}")'.format(
                absolute_reverse('api_form_attachment',
                                 args=('my-domain', '1234', '1234.jpg'))))