Ejemplo n.º 1
0
class JobTest_Application(TestCase):
    @patch("pyjobs.core.models.post_telegram_channel")
    def setUp(self, _mocked_post_telegram_channel):
        self.job = Job(
            title="Vaga 3",
            workplace="Sao Paulo",
            company_name="XPTO",
            company_email="*****@*****.**",
            description="Job bem maneiro",
            premium=True,
            public=True,
        )
        self.user = User.objects.create_user(username="******",
                                             email="*****@*****.**",
                                             password="******")

        self.profile = Profile.objects.create(
            user=self.user,
            github="http://www.github.com/foobar",
            linkedin="http://www.linkedin.com/in/foobar",
            portfolio="http://www.foobar.com/",
            cellphone="11981435390",
        )

        self.job.save()

    def test_user_is_not_applied(self):
        application_status = self.job.applied(self.user)
        self.assertEqual(application_status, False)

    def test_user_is_applied(self):
        self.job.apply(self.user)
        application_status = self.job.applied(self.user)
        self.assertEqual(application_status, True)
Ejemplo n.º 2
0
class JobTest_Application(TestCase):
    @responses.activate
    @patch("pyjobs.marketing.triggers.send_group_notification")
    @patch("pyjobs.marketing.triggers.send_job_to_github_issues")
    @patch("pyjobs.marketing.triggers.post_telegram_channel")
    def setUp(self, _mocked_send_group_push, _mock_github,
              _mocked_post_telegram_channel):
        self.job = Job(
            title="Vaga 3",
            workplace="Sao Paulo",
            company_name="XPTO",
            company_email="*****@*****.**",
            description="Job bem maneiro",
            premium=True,
            public=True,
        )

        responses.add(
            responses.POST,
            "https://api.mailerlite.com/api/v2/subscribers",
            json={"status": "Success"},
            status=200,
        )

        self.user = User.objects.create_user(username="******",
                                             email="*****@*****.**",
                                             password="******")

        self.profile = Profile.objects.create(
            user=self.user,
            github="http://www.github.com/foobar",
            linkedin="http://www.linkedin.com/in/foobar",
            portfolio="http://www.foobar.com/",
            cellphone="11981435390",
        )

        self.job.save()

    def test_user_is_not_applied(self):
        application_status = self.job.applied(self.user)
        self.assertEqual(application_status, False)

    def test_user_is_applied(self):
        self.job.apply(self.user)
        application_status = self.job.applied(self.user)
        self.assertEqual(application_status, True)