コード例 #1
0
 def test_monkeypatched_get_distribution_behaves_like_existing_one(self):
     """Test that the monkey-patched get_distribution() method returns an
     object with a suitable version string for google-cloud-tasks.
     """
     assert_raises_regexp_context_manager = self.assertRaisesRegexp(
         pkg_resources.DistributionNotFound, 'invalid-lib')
     with self.swap(appengine_config, 'old_get_distribution',
                    self._mock_get_distribution_which_raises_error):
         with assert_raises_regexp_context_manager:
             appengine_config.monkeypatched_get_distribution('invalid-lib')
コード例 #2
0
 def test_monkeypatched_get_distribution_for_google_cloud_tasks(self):
     """Test that the monkey-patched get_distribution() method returns an
     object with a suitable version string for google-cloud-tasks.
     """
     with self.swap(appengine_config, 'old_get_distribution',
                    self._mock_get_distribution_which_raises_error):
         mock_distribution = appengine_config.monkeypatched_get_distribution(
             'google-cloud-tasks')
     self.assertEqual(mock_distribution.version, '1.5.0')