Esempio n. 1
0
    def test_single_url(self):
        dummy_data = {'_paramAdditionalUrls': ['foo']}

        field = plm.AdditionalUrlField("additionalAudioUrl")

        ret = field.formatter(None, dummy_data, 'test')

        self.assertEqual(ret, {'foo': 'test'})
Esempio n. 2
0
    def test_single_url(self):
        dummy_data = {"_paramAdditionalUrls": ["foo"]}

        field = plm.AdditionalUrlField("additionalAudioUrl")

        ret = field.formatter(None, dummy_data, "test")

        self.assertEqual(ret, {"foo": "test"})
Esempio n. 3
0
    def test_multiple_urls(self):
        dummy_data = {
            '_paramAdditionalUrls': [
                'abc',
                'def',
            ]
        }

        field = plm.AdditionalUrlField("additionalAudioUrl")

        ret = field.formatter(None, dummy_data, ['foo', 'bar'])

        expected = {
            'abc': 'foo',
            'def': 'bar',
        }

        self.assertEqual(ret, expected)
Esempio n. 4
0
    def test_multiple_urls(self):
        dummy_data = {
            "_paramAdditionalUrls": [
                "abc",
                "def",
            ]
        }

        field = plm.AdditionalUrlField("additionalAudioUrl")

        ret = field.formatter(None, dummy_data, ["foo", "bar"])

        expected = {
            "abc": "foo",
            "def": "bar",
        }

        self.assertEqual(ret, expected)