コード例 #1
0
ファイル: test.py プロジェクト: appleface2050/ESNS
 def create_zhgl_company_news(self, company_id, type_flag, flag, user_id):
     """
     测试
     by:尚宗凯 at:2015-07-02
     """
     resonse = self.client.post('/cp/%s/create_zhgl_company_news'%str(company_id), {"type_flag":type_flag, "flag":flag})
     company_column_id = CompanyColumn.objects.get(company_id=company_id, flag=flag).pk
     sn = CompanyNews()
     sn.company_id = company_id
     sn.company_column_id = company_column_id
     sn.author_id = user_id
     sn.pre_title = ""
     # if type_flag not in ("files", "images"):
     #     sn.pre_content = ""
     # else:
     #     fileids = [x for x in request.REQUEST.get('fileid', '').strip(',').split(',') if x]
     #     for fid in fileids:
     #         sn.append_file(fid)
     sn.title = sn.pre_title
     sn.content = sn.pre_content
     sn.is_active = True
     if type_flag:
         sn.type_flag = type_flag
     try:
         sn.save()
         self.assertJSONEqual(resonse.content["message"], getTestResult(True, u'创建公司新闻成功'),
                          u'错误')
     except Exception:
         pass
コード例 #2
0
ファイル: test.py プロジェクト: appleface2050/ESNS
 def create_company_news(self, com_column_id, company_id, pre_title, title, pre_content, content, author_id):
     """
     创建公司新闻
     by:尚宗凯 at:2015-06-11
     """
     resonse = self.client.post('/cp/create_company_news', {"com_column_id":com_column_id, "company_id":company_id, "pre_title":pre_title, "title":title, "pre_content":pre_content,"content":content, "author_id":author_id})
     sn = CompanyNews()
     sn.com_column_id = com_column_id
     sn.company_id = company_id
     sn.pre_title = pre_title
     sn.title = title
     sn.pre_content = pre_content
     sn.content = content
     sn.author_id = author_id
     sn.is_active = False
     sn.create_time = timezone.now()
     try:
         sn.save()
         self.assertJSONEqual(resonse.content, getTestResult(True, u'创建公司新闻成功'),u'错误')
     except:
         pass