コード例 #1
0
    def test_update_field(self):
        self.add_message()
        self.add_P2C()
        kwargs = {'post_id': self.post_id2}

        self.add_message(**kwargs)
        ss = MPost2Catalog.query_by_post(self.post_id)

        MPost2Catalog.update_field(ss[0].uid, post_id=kwargs['post_id'])
        aa = MPost2Catalog.query_by_post(kwargs['post_id'])

        assert ss[0].uid == aa[0].uid
        self.tearDown()
コード例 #2
0
 def test_del_by_uid(self):
     self.add_message()
     self.add_P2C()
     ss = MPost2Catalog.query_by_post(self.post_id)
     a = MPost2Catalog.del_by_uid(ss[0].uid)
     assert a
     self.tearDown()
コード例 #3
0
    def test_add_record(self):
        self.add_message()

        MPost2Catalog.add_record(self.post_id, self.tag_id)
        Po = MPost2Catalog.query_by_post(self.post_id)

        assert Po.count() > 0
        self.tearDown()
コード例 #4
0
 def render(self, map_id):
     rec = MPost2Catalog.query_by_post(map_id)
     for x in rec:
         result = MCategory.get_by_uid(x.tag_id)
         return result.slug
コード例 #5
0
ファイル: script_migrate.py プロジェクト: wwwK/maplet
from torcms.handlers.post_handler import MPost
from torcms.model.post2catalog_model import MPost2Catalog
from torcms.model.evaluation_model import MEvaluation

from torcms.model.usage_model import MUsage

from torcms.model.json_model import MPost2Gson

all_apps = MPost.query_all(kind='m', limit=100000)
for app in all_apps:
    print('=' * 20)
    print(app.uid)

    if len(app.uid) == 4:
        MPost.update_field(app.uid, post_id='m' + app.uid)
    for post2tag in MPost2Catalog.query_by_post(app.uid):
        if len(post2tag.post_id) == 4:
            MPost2Catalog.update_field(post2tag.uid,
                                       post_id='m' + post2tag.post_id)

    for post2tag in MUsage.query_by_post(app.uid):
        if len(post2tag.post_id) == 4:
            MUsage.update_field(post2tag.uid, post_id='m' + post2tag.post_id)

    for post2tag in MPost2Gson.query_by_post(app.uid):
        if len(post2tag.post_id) == 4:
            MPost2Gson.update_field(post2tag.uid,
                                    post_id='m' + post2tag.post_id)
コード例 #6
0
 def test_query_by_post(self):
     self.add_message()
     self.add_P2C()
     ss = MPost2Catalog.query_by_post(self.post_id)
     assert ss[0].tag_id == self.tag_id
     self.tearDown()
コード例 #7
0
ファイル: test_post2catalog.py プロジェクト: brucehe3/TorCMS
 def test_query_by_post(self):
     MPost2Catalog.query_by_post(self.post_id)
     assert True