Ejemplo n.º 1
0
    def test_it_checks_check_owner(self):
        charlies_project = Project.objects.create(owner=self.charlie)
        charlies_channel = Channel(project=charlies_project, kind="email")
        charlies_channel.email = "*****@*****.**"
        charlies_channel.save()

        payload = {"channel": charlies_channel.code, "check-%s" % self.check.code: True}
        self.client.login(username="******", password="******")
        r = self.client.post(self.channels_url, data=payload)

        # mc belongs to charlie but self.check does not--
        self.assertEqual(r.status_code, 404)
    def test_it_checks_check_user(self):
        charlies_channel = Channel(user=self.charlie, kind="email")
        charlies_channel.email = "*****@*****.**"
        charlies_channel.save()

        payload = {
            "channel": charlies_channel.code,
            "check-%s" % self.check.code: True
        }
        self.client.login(username="******", password="******")
        r = self.client.post("/integrations/", data=payload)

        # mc belongs to charlie but self.check does not--
        assert r.status_code == 403
Ejemplo n.º 3
0
    def test_it_checks_check_user(self):
        mallory = User(username="******", email="*****@*****.**")
        mallory.set_password("password")
        mallory.save()

        mc = Channel(user=mallory, kind="email")
        mc.email = "*****@*****.**"
        mc.save()

        payload = {"channel": mc.code, "check-%s" % self.check.code: True}
        self.client.login(username="******", password="******")
        r = self.client.post("/integrations/", data=payload)

        # mc belongs to mallorym but self.check does not--
        assert r.status_code == 403
Ejemplo n.º 4
0
    def test_it_checks_check_user(self):
        mallory = User(username="******", email="*****@*****.**")
        mallory.set_password("password")
        mallory.save()

        mc = Channel(user=mallory, kind="email")
        mc.email = "*****@*****.**"
        mc.save()

        payload = {
            "channel": mc.code,
            "check-%s" % self.check.code: True
        }
        self.client.login(username="******", password="******")
        r = self.client.post("/integrations/", data=payload)

        # mc belongs to mallorym but self.check does not--
        assert r.status_code == 403