Beispiel #1
0
    def test_good_content(self):
        """Confirm that everything works right if the content is good"""

        monitor = Monitor('http://fake', {"content": ["fake"]})
        monitor._fetch_contents = Mock(return_value="Some fake content")
        result = monitor.check()

        assert result is not False
Beispiel #2
0
    def test_ioerror(self):
        """Confirm correct behavior on network error"""

        monitor = Monitor('http://fake', {})
        monitor._fetch_contents = Mock(side_effect=IOError)
        result = monitor.check()

        assert result is False
Beispiel #3
0
    def test_invalid_content(self):
        """Confirm correct behavior on invalid content"""

        monitor = Monitor('http://fake', {})
        monitor._fetch_contents = Mock(return_value="Some fake content")
        monitor._check_contents = Mock(return_value=False)
        result = monitor.check()

        assert result is False