• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla-releng / balrog / #5214

16 Feb 2026 01:14AM UTC coverage: 16.352% (-73.5%) from 89.9%
#5214

Pull #3672

circleci

renovate-bot
chore(deps): lock file maintenance (pep621)
Pull Request #3672: chore(deps): lock file maintenance (pep621)

267 of 2546 branches covered (10.49%)

Branch coverage included in aggregate %.

1169 of 6236 relevant lines covered (18.75%)

0.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/auslib/web/admin/views/validators.py
1
import logging
×
2
from typing import AnyStr, Union
×
3

4
import jsonschema
×
5
from connexion.decorators.validation import RequestBodyValidator
×
6
from connexion.exceptions import BadRequestProblem
×
7
from connexion.lifecycle import ConnexionResponse
×
8
from connexion.utils import is_null
×
9

10
# To enable shared jsonschema validators
11
import auslib.util.jsonschema_validators  # noqa
×
12
from auslib.util.timestamp import getMillisecondTimestamp
×
13

14
logger = logging.getLogger(__name__)
×
15

16

17
class BalrogRequestBodyValidator(RequestBodyValidator):
×
18
    def validate_schema(self, data: dict, url: AnyStr) -> Union[ConnexionResponse, None]:
×
19
        """This function is largely based on https://github.com/zalando/connexion/blob/master/connexion/decorators/validation.py
20
        and should largely be kept in line with it."""
21
        if self.is_null_value_valid and is_null(data):
×
22
            return None
×
23
        try:
×
24
            self.validator.validate(data)
×
25
        except jsonschema.ValidationError as exception:
×
26
            # Add field name to the error response
27
            exception_field = ""
×
28
            for i in exception.path:
×
29
                exception_field = i + ": "
×
30
            if exception.__cause__ is not None:
×
31
                exception_message = exception.__cause__.message + " " + exception_field + exception.message
×
32
            else:
33
                exception_message = exception_field + exception.message
×
34
            # Some exceptions could contain unicode characters - if we don't replace them
35
            # we could end up with a UnicodeEncodeError.
36
            logger.warning("{url} validation error: {error}".format(url=url, error=exception_message.encode("utf-8", "replace")))
×
37
            raise BadRequestProblem(detail=exception_message)
×
38

39
        return None
×
40

41

42
def is_when_present_and_in_past_validator(what):
×
43
    """Validates if scheduled_change_time value i.e. 'when' field value is present in
44
    input dictionary/object and if its value is in past or not"""
45
    return what.get("when", None) and int(what.get("when")) < getMillisecondTimestamp()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc