@@ -0,0 +1,2104 @@
+%22%22%22Tests for the jobs.tasks.%22%22%22%0A%0Afrom ..models import Post, Job, Freelancer%0Afrom ..tasks import process_new_posts, create_jobs, create_freelancers, tag_jobs, tag_freelancers%0A%0A%0Adef test_post_processing(post_factory):%0A    %22%22%22Verify that all posts are processed.%22%22%22%0A    post_factory(processed=False)%0A    pre_unprocessed_posts = Post.objects.filter(processed=False).count()%0A    process_new_posts()%0A    post_unprocessed_posts = Post.objects.filter(processed=False).count()%0A%0A    assert pre_unprocessed_posts != post_unprocessed_posts%0A    assert post_unprocessed_posts == 0%0A%0A%0Adef test_create_jobs(post_factory):%0A    %22%22%22Verify that jobs are created.%22%22%22%0A    post_factory(is_freelance=True, is_job_posting=True, processed=False, job=None)%0A    pre_jobs = Job.objects.all().count()%0A    create_jobs()%0A    post_jobs = Job.objects.all().count()%0A%0A    assert post_jobs != 0%0A    assert pre_jobs != post_jobs%0A%0A%0Adef test_create_freelancers(post_factory):%0A    %22%22%22Verify that freelancers are created.%22%22%22%0A    post_factory(is_freelance=True, is_freelancer=True, processed=False, freelancer=None)%0A    pre_freel = Freelancer.objects.all().count()%0A    create_freelancers()%0A    post_freel = Freelancer.objects.all().count()%0A%0A    assert post_freel != 0%0A    assert pre_freel != post_freel%0A%0A%0Adef test_tag_jobs(job_factory, tag_factory):%0A    %22%22%22Verify that tags are added.%22%22%22%0A    job = job_factory(title=%22Bears%22)%0A    job.tags.clear()%0A    job.save()%0A    tag_factory(name=%22bears%22)%0A    tag_jobs()%0A%0A    changed_job = Job.objects.get(pk=job.id)%0A    new_tags = list(changed_job.tags.all().values_list('name', flat=True))%0A    assert len(new_tags) %3E 0%0A    assert 'bears' in new_tags%0A%0A%0Adef test_tag_freelancers(freelancer_factory, tag_factory):%0A    %22%22%22Verify that tags are added.%22%22%22%0A    freelancer = freelancer_factory(title=%22Bores%22)%0A    freelancer.tags.clear()%0A    freelancer.save()%0A    tag_factory(name=%22bores%22)%0A    tag_freelancers()%0A%0A    changed_freelancer = Freelancer.objects.get(pk=freelancer.id)%0A    new_tags = list(changed_freelancer.tags.all().values_list('name', flat=True))%0A    assert len(new_tags) %3E 0%0A    assert 'bores' in new_tags%0A

add tests for tasks