Example #1
0
    def test_can_get_default_violations_values(self):
        config = Config()
        config.MAX_IMAGE_ALT_SIZE = 70

        page = PageFactory.create()

        reviewer = Reviewer(
            api_url='http://localhost:2368',
            page_uuid=page.uuid,
            page_url=page.url,
            page_score=0.0,
            config=config,
            validators=[]
        )

        validator = ImageAltValidator(reviewer)

        violations_values = validator.get_default_violations_values(config)

        expect(violations_values).to_include('invalid.images.alt_too_big')

        expect(violations_values['invalid.images.alt_too_big']).to_length(2)

        expect(violations_values['invalid.images.alt_too_big']).to_be_like({
            'value': config.MAX_IMAGE_ALT_SIZE,
            'description': config.get_description('MAX_IMAGE_ALT_SIZE')
        })