def test_job_model(company, location, session): title = u'ríbëyé' recruiter_name = u'相' recruiter_email = u'思' job = Job(title=title, description=title, contact_method=1, remote_work=False, company=company, location=location, job_type=1, recruiter_name=recruiter_name, recruiter_email=recruiter_email) session.add(job) session.commit() assert job.id > 0 assert not job.published assert job.company_id == company.id assert job.company.id == company.id assert job.location_id == location.id assert job.location.id == location.id assert job.title == title assert job.description == title assert job.contact_method == 1 assert job.job_type == 1 assert job.slug == normalize('NFKD', title) assert str(job.id) in job.url() assert job.company.slug in job.url() assert 'http' not in job.url() assert str(job.id) in job.url(external=True) assert job.company.slug in job.url(external=True) assert 'http' in job.url(external=True) assert str(job.id) in job.edit_url() and job.admin_token in job.edit_url() assert job.recruiter_name == recruiter_name assert job.recruiter_email == recruiter_email assert job.created <= now() # Check if we get `arrow` dates back. assert type(job.created) is Arrow