def add(cls, id, company_id, city_id, title, work_year='', department='', salary='', education='', description='', advantage='', job_nature='', created_at=0): JobModel.add(id=id, title=title, city_id=city_id, company_id=company_id, work_year=work_year, department=department, salary=salary, education=education, description=description, advantage=advantage, job_nature=job_nature, created_at=created_at)
def test_add_job(self): data = { 'id': 1001, 'title': '招聘绅士hentai', 'work_year': 3, 'city_id': 2, 'company_id': 11, 'department': '二次元部门', 'salary': '60k-100k', 'education': 2, 'description': '这是JD这是JD这是JD这是JD这是JD这是JD', 'advantage': '有妹子', 'job_nature': 2, 'created_at': 1494957220, } JobModel.add(**data) jobs = JobModel.list() self.assertEqual(len(jobs), 3) job = JobModel.get(job_id=1001) for (key, value) in data.items(): self.assertEqual(getattr(job, key), value)