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
def test_check_contents(self): """Confirm that _check_contents does it's job""" doc = """ This is a webpage, trust me. See, here's an element: <h1> Keyword. Key phrase. The End. """ settings = {"content": ["Keyword", "Key phrase"]} result = Monitor._check_contents(doc, settings) assert result is True