Exemple #1
0
    def test_keyvalue_to_links_params(self):
        value = {'target': 'http://example.com/target'}

        result = core.keyvalue_to_links(value, rel='alternative')
        self.assertEqual(result, [
            {
                'href': 'http://example.com/target',
                'prompt': 'target',
                'rel': 'alternative',
            },
        ])
Exemple #2
0
    def test_keyvalue_to_links(self):
        value = {
            'foo': 'http://foo.example.com/',
            'key': 'http://key.example.com/',
        }

        result = core.keyvalue_to_links(value)
        self.assertEqual(result, [
            {
                'href': 'http://foo.example.com/',
                'prompt': 'foo',
                'rel': 'bookmark',
            },
            {
                'href': 'http://key.example.com/',
                'prompt': 'key',
                'rel': 'bookmark',
            }
        ])

        self.assertEqual(core.keyvalue_to_links({}), [])