def test_fetch_test_cases_run(self, fetch): """ Assert that Build.update_test_cases is called. """ update = self.db.query(models.Update).join( models.Build).filter(models.Build.nvr == 'bodhi-2.0-1.fc17').one() fetch_test_cases_main(update.alias) fetch.assert_called_once()
def test_update_nonexistent(self, fetch): """ Assert BodhiException is raised if the update doesn't exist. """ with pytest.raises(BodhiException) as exc: fetch_test_cases_main('foo') assert str(exc.value) == "Couldn't find alias foo in DB" fetch.assert_not_called()
def test_fetch_test_cases_exception(self, warning, MediaWiki): """ Assert that fetch_test_cases logs a warning when an exception is raised. """ MediaWiki.return_value.call.side_effect = URLError("oh no!") update = self.db.query(models.Update).join( models.Build).filter(models.Build.nvr == 'bodhi-2.0-1.fc17').one() with pytest.raises(ExternalCallException): fetch_test_cases_main(update.alias) warning.assert_called_once_with( 'Error occurred during fetching testcases', exc_info=True)