def test_mock_title_object(self,mock_gt):
     url="www.google.com"
     t=Title()
     mock_gt.return_value="test"
     value=t.get_url_title(url)
     # this is a nice feature, we can assure that this internal module was called with a certain parameter
     mock_gt.assert_called_with()
     # This is a great feature, where we replace the result of the inner module
     self.assertTrue(value=="test","should return mocked title ")
     # however, the other methods works without an issue, as usual.
     self.assertTrue(t.check_url(url)==200)
Exemple #2
0
from simplemath.calculator import Calculator
from net.Title import Title

if __name__ =="__main__":
    url="www.google.com"
    t=Title()
    print(t.get_url_title(url))