Exemple #1
0
    def test_bad_version(self):
        project = self.create_project()
        user = self.create_user()
        hook = HerokuReleaseHook(project)

        req = Mock()
        req.POST = {"head_long": "", "url": "http://example.com", "user": user.email}
        with self.assertRaises(HookValidationError):
            hook.handle(req)
Exemple #2
0
    def test_email_mismatch(self):
        user = self.create_user()
        organization = self.create_organization(owner=user)
        project = self.create_project(organization=organization)
        hook = HerokuReleaseHook(project)

        req = Mock()
        req.POST = {"head_long": "v999", "url": "http://example.com", "user": "******"}
        hook.handle(req)
        assert Release.objects.filter(version=req.POST["head_long"]).exists()
Exemple #3
0
    def test_user_success(self):
        user = self.create_user()
        organization = self.create_organization(owner=user)
        project = self.create_project(organization=organization)
        hook = HerokuReleaseHook(project)
        hook.set_refs = Mock()

        req = Mock()
        req.POST = {"head_long": "abcd123", "url": "http://example.com", "user": user.email}
        hook.handle(req)
        assert Release.objects.filter(version=req.POST["head_long"]).exists()
        assert hook.set_refs.call_count == 1
    def test_bad_version(self):
        project = self.create_project()
        user = self.create_user()
        hook = HerokuReleaseHook(project)

        req = Mock()
        req.POST = {
            'head_long': '',
            'url': 'http://example.com',
            'user': user.email,
        }
        with self.assertRaises(HookValidationError):
            hook.handle(req)
    def test_bad_version(self):
        project = self.create_project()
        user = self.create_user()
        hook = HerokuReleaseHook(project)

        req = Mock()
        req.POST = {
            'head_long': '',
            'url': 'http://example.com',
            'user': user.email,
        }
        with self.assertRaises(HookValidationError):
            hook.handle(req)