Beispiel #1
0
 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