def test_flush_method(self):
        validator = Validator(None)
        validator.enqueue = Mock()

        validator.flush()

        expect(validator.enqueue.call_count).to_equal(0)

        validator = Validator(None)
        validator.url_buffer = [1, 2, 3]
        validator.enqueue = Mock()

        validator.flush()

        validator.enqueue.assert_called_once_with([1, 2, 3])
Esempio n. 2
0
    def test_flush_method(self):
        validator = Validator(None)
        validator.enqueue = Mock()

        validator.flush()

        expect(validator.enqueue.call_count).to_equal(0)

        validator = Validator(None)
        validator.url_buffer = [1, 2, 3]
        validator.enqueue = Mock()

        validator.flush()

        validator.enqueue.assert_called_once_with([1, 2, 3])
    def test_will_call_reviewer_enqueue(self):
        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=[],
        )
        reviewer.enqueue = Mock()

        validator = Validator(reviewer)
        validator.enqueue("/")

        reviewer.enqueue.assert_called_once_with("/")
Esempio n. 4
0
    def test_will_call_reviewer_enqueue(self):
        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=[]
        )
        reviewer.enqueue = Mock()

        validator = Validator(reviewer)
        validator.enqueue('/')

        reviewer.enqueue.assert_called_once_with('/')