def create_sys_news(self, sys_column_id, company_id, pre_title, title, pre_content, content, author_id): """ 测试 by:尚宗凯 at:2015-06-11 """ resonse = self.client.post('/cp/create_sys_news', {"sys_column_id":sys_column_id, "company_id":company_id, "pre_title":pre_title, "title":title, "pre_content":pre_content, "content":content,"author_id":author_id}) sn = SysNews() sn.sys_column_id = sys_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 Exception as e: pass
def test_company(self): self.login(username, '123456') #测试公司接口 #by:尚宗凯 at:2015-6-11 test_bc = BigCompany() test_bc.name = "测试name" test_bc.logo = "1" test_bc.save() user = get_user_model().objects.get(tel=1003) self.login(user.tel, u'123456') self.create_company(user.pk, test_bc.pk, 2, 2 ) self.my_company(user.pk) self.get_default_big_company() self.get_default_sys_news() self.get_all_big_company() sys_column = SysColumn() sys_column.name = "1" sys_column.index_num = 0 sys_column.is_active = True sys_column.flag = "1" sys_column.timeline = 0 sys_column.save() sys_news = SysNews() sys_news.sys_column_id = sys_column.pk sys_news.company_id = Company.objects.all()[0].pk sys_news.pre_title = "pre_title" sys_news.title = "title" sys_news.pre_content = "pre_comtent" sys_news.content = "content" sys_news.author_id = user.pk sys_news.is_active = True sys_news.create_time = timezone.now() sys_news.publish_time = timezone.now() sys_news.save() # self.save_news(user.pk, sys_news.pk, 0) # self.get_my_save_news(user.pk) company_banner = CompanyBanner() company_banner.company_id = Company.objects.all()[0].pk company_banner.image = 1 company_banner.url = " " company_banner.index_num = 0 company_banner.is_active = True company_banner.timeline = 0 company_banner.save() sys_banner = SysBanner() sys_banner.image = 0 sys_banner.url = " " sys_banner.index_num = 1 sys_banner.is_active = True sys_banner.timeline = 0 sys_banner.save() self.set_company_banner(1, "https://www.baidu.com/img/bdlogo.png", 1 ,"True", company_banner.pk) self.set_sys_banner(1,"https://www.baidu.com/img/bdlogo.png",1,"True",sys_banner.pk) company_column = CompanyColumn() company_column.company_id = Company.objects.all()[0].pk company_column.name = "company_column" company_column.columntype = 0 company_column.index_num = 1 company_column.is_active = True company_column.flag = "company_column" company_column.save() # self.create_company_news(company_column.pk, Company.objects.all()[0].pk, "pre_title", "title", "pre_content", "content", user.pk) #增加新的一批单元测试 #by:尚宗凯 at:2015-07-02 self.add_user_to_company([user.pk], Company.objects.all()[0].pk) self.set_company_admin(user.pk, Company.objects.all()[0].pk) self.get_company_detail_by_id(Company.objects.all()[0].pk) # a = CompanyPerson.objects.get(user_id=user.pk, company_id=Company.objects.all()[0].pk) # a.creator_type = True # a.save() self.create_zhgl_company_news(Company.objects.all()[0].pk,"news","TONGZHIGONGGAO",user.pk) self.update_sys_column(sys_column.pk,"测试名字") self.query_company_by_name() self.query_company_by_bigcompnay() self.query_company_pv(Company.objects.all()[0].pk, user.pk) self.ding_news_by_id(sys_news.pk, Company.objects.all()[0].pk, user.pk) self.delete_ding_news_by_id(sys_news.pk, Company.objects.all()[0].pk, user.pk) self.ding_favorite_by_id(sys_news.pk, Company.objects.all()[0].pk, user.pk) # self.delete_favorite_news_by_id(sys_news.pk, Company.objects.all()[0].pk, user.pk) self.get_sys_column_by_column_id(sys_column.pk) self.set_company_admin(user.pk, Company.objects.all()[0].pk) self.set_company_status(Company.objects.all()[0].pk, "0") self.delete_company_user(Company.objects.all()[0].pk,11) self.get_permission(Company.objects.all()[0].pk) self.query_permission(Company.objects.all()[0].pk,user.pk) # self.get_child_comapny_column_list(Company.objects.all()[0].pk,"GONGSIJIANJIE") self.get_qiyezixun_news(Company.objects.all()[0].pk) self.get_news_by_flag(Company.objects.all()[0].pk) self.get_company_column_by_flag(Company.objects.all()[0].pk) self.get_company_column_by_company(Company.objects.all()[0].pk) project = Project.objects.all()[0] self.close_project(project.pk) self.delete_project(project.pk) self.show_zhgl_list(Company.objects.all()[0].pk,company_column.pk) # self.update_company_column(Company.objects.all()[0].pk, "new column", 1, 1, "True", None, "flag", company_column.pk) self.set_company_admin(user.pk, Company.objects.all()[0].pk) self.company_banner(Company.objects.all()[0].pk) self.get_company_column(Company.objects.all()[0].pk) self.get_company_news(Company.objects.all()[0].pk) self.get_project_by_company(Company.objects.all()[0].pk) self.set_follow_company(user.pk, Company.objects.all()[0].pk) self.cancel_follow_company(user.pk, Company.objects.all()[0].pk) self.create_bigcompany(name="a",logo=2) self.create_sys_news(sys_column.pk,Company.objects.all()[0].pk,"pre_title","title","pre_content","content",user.pk) self.release_sys_news(SysNews.objects.all()[0].pk) self.cancel_release_sys_news(SysNews.objects.all()[0].pk) self.create_sys_column("test_column",1,None,"test_column")