Beispiel #1
0
    def test_serialize_Content_comment_THREAD(self):
        wor = Workspace()
        wor.workspace_id = 4

        fol = Content()
        fol.type = ContentType.Folder
        fol.content_id = 72
        fol.workspace = wor

        par = Content()
        par.type = ContentType.Thread
        par.content_id = 37
        par.parent = fol
        par.workspace = wor
        par.created = datetime.now()

        obj = Content()
        obj.type = ContentType.Comment
        obj.content_id = 132
        obj.label = 'some label'
        obj.description = 'Some Description'
        obj.parent = par
        obj.created = datetime.now()

        print('LANGUAGES #2 ARE', tg.i18n.get_lang())
        res = Context(CTX.THREAD).toDict(obj)
        eq_(res.__class__, DictLikeClass, res)

        ok_('label' in res.keys())
        eq_(obj.label, res.label, res)

        ok_('content' in res.keys())
        eq_(obj.description, res.content, res)

        ok_('created' in res.keys())

        ok_('icon' in res.keys())
        eq_(ContentType.get_icon(obj.type), res.icon, res)

        ok_('delete' in res.urls.keys())

        eq_(10, len(res.keys()), len(res.keys()))
Beispiel #2
0
    def test_serialize_Content_comment_THREAD(self):
        wor = Workspace()
        wor.workspace_id = 4

        fol = Content()
        fol.type = ContentType.Folder
        fol.content_id = 72
        fol.workspace = wor

        par = Content()
        par.type = ContentType.Thread
        par.content_id = 37
        par.parent = fol
        par.workspace = wor
        par.created = datetime.now()

        obj = Content()
        obj.type = ContentType.Comment
        obj.content_id = 132
        obj.label = 'some label'
        obj.description = 'Some Description'
        obj.parent = par
        obj.created = datetime.now()

        print('LANGUAGES #2 ARE', tg.i18n.get_lang())
        res = Context(CTX.THREAD).toDict(obj)
        eq_(res.__class__, DictLikeClass, res)

        ok_('label' in res.keys())
        eq_(obj.label, res.label, res)

        ok_('content' in res.keys())
        eq_(obj.description, res.content, res)

        ok_('created' in res.keys())

        ok_('icon' in res.keys())
        eq_(ContentType.get_icon(obj.type), res.icon, res)

        ok_('delete' in res.urls.keys())

        eq_(10, len(res.keys()), len(res.keys()))