Exemple #1
0
    def test_plugin_mismatch(self):
        storage.set('i18n://[email protected]#draft', u'A')
        storage.publish('i18n://[email protected]#draft')

        with self.assertRaises(NodeDoesNotExist):
            storage.get('i18n://[email protected]')

        nodes = storage.get_many(('i18n://[email protected]',))
        self.assertDictEqual(nodes, {})
    def test_plugin_mismatch(self):
        storage.set('i18n://[email protected]#draft', u'A')
        storage.publish('i18n://[email protected]#draft')

        with self.assertRaises(NodeDoesNotExist):
            storage.get('i18n://[email protected]')

        nodes = storage.get_many(('i18n://[email protected]', ))
        self.assertDictEqual(nodes, {})
Exemple #3
0
    def test_get(self):
        storage.set('i18n://[email protected]#draft', u'A')
        storage.set('i18n://[email protected]#draft', u'B')
        node = storage.get('i18n://sv-se@a#draft')
        self.assertEqual(node['uri'], 'i18n://[email protected]#draft')
        self.assertEqual(node['content'], u'A')

        storage.publish('i18n://sv-se@a#draft')
        storage.publish('i18n://sv-se@b#draft')

        nodes = storage.get_many(('i18n://sv-se@a', 'i18n://sv-se@b'))
        for node in nodes.values():
            node.pop('meta')
        self.assertDictEqual(nodes, {
            'i18n://sv-se@a': {
                'uri': 'i18n://[email protected]#1',
                'content': u'A'
            },
            'i18n://sv-se@b': {
                'uri': 'i18n://[email protected]#1',
                'content': u'B'
            }
        })
    def test_get(self):
        storage.set('i18n://[email protected]#draft', u'A')
        storage.set('i18n://[email protected]#draft', u'B')
        node = storage.get('i18n://sv-se@a#draft')
        self.assertEqual(node['uri'], 'i18n://[email protected]#draft')
        self.assertEqual(node['content'], u'A')

        storage.publish('i18n://sv-se@a#draft')
        storage.publish('i18n://sv-se@b#draft')

        nodes = storage.get_many(('i18n://sv-se@a', 'i18n://sv-se@b'))
        for node in nodes.values():
            node.pop('meta')
        self.assertDictEqual(
            nodes, {
                'i18n://sv-se@a': {
                    'uri': 'i18n://[email protected]#1',
                    'content': u'A'
                },
                'i18n://sv-se@b': {
                    'uri': 'i18n://[email protected]#1',
                    'content': u'B'
                }
            })