def test_warn_if_version_is_not_up_to_date(self, get, log): response = Mock(json=lambda: {'info': {'version': 0}}) get.return_value = response main.check_mozregression_version() self.assertEqual(log.warning.call_count, 2)
def test_version_is_upto_date(self, get, log): response = Mock(json=lambda: {'info': {'version': __version__}}) get.return_value = response main.check_mozregression_version() self.assertFalse(log.critical.called)
def test_Exception_error(self, get): get.side_effect = requests.RequestException # exception is handled inside main.check_mozregression_version main.check_mozregression_version() self.assertRaises(requests.RequestException, get)
def test_warn_if_version_is_not_up_to_date(self, get): logger = Mock() response = Mock(json=lambda: {"info": {"version": 0}}) get.return_value = response main.check_mozregression_version(logger) self.assertEqual(logger.warning.call_count, 2)
def test_version_is_upto_date(self, get): logger = Mock() response = Mock(json=lambda: {"info": {"version": __version__}}) get.return_value = response main.check_mozregression_version(logger) self.assertFalse(logger.critical.called)