~fginther/landscape-client/fix-missing-install-dirs

« back to all changes in this revision

Viewing changes to landscape/package/tests/test_reporter.py

  • Committer: 🤖 Landscape Builder
  • Author(s): Steffen Allner
  • Date: 2017-04-05 20:19:53 UTC
  • mfrom: (999.1.1 fetch-returns-bytes-in-tests)
  • Revision ID: _landscape_builder-20170405201953-u14zw48hzg0g8wu1
Merge fetch-returns-bytes-in-tests [f=] [r=simpoir,ericsnowcurrently,landscape-builder] [a=Gocept]
Return bytes from mocks of landscape.lib.fetch.fetch().

In this MP an inconsistency between tests and actual implementation was fixed. The landscape.lib.fetch.fetch() returns bytes now explicitly, but this was not reflected in the mocks used throughout the landscape-client project.

I tried to convert all return values of the mocks to bytes and adjusted the tests accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
270
270
        return deferred.addCallback(got_result)
271
271
 
272
272
    @mock.patch("landscape.package.reporter.fetch_async",
273
 
                return_value=succeed("hash-ids"))
 
273
                return_value=succeed(b"hash-ids"))
274
274
    @mock.patch("logging.info", return_value=None)
275
275
    def test_fetch_hash_id_db(self, logging_mock, mock_fetch_async):
276
276
 
308
308
        return result
309
309
 
310
310
    @mock.patch("landscape.package.reporter.fetch_async",
311
 
                return_value=succeed("hash-ids"))
 
311
                return_value=succeed(b"hash-ids"))
312
312
    @mock.patch("logging.info", return_value=None)
313
313
    def test_fetch_hash_id_db_with_proxy(self, logging_mock, mock_fetch_async):
314
314
        """fetching hash-id-db uses proxy settings"""
414
414
        return result
415
415
 
416
416
    @mock.patch("landscape.package.reporter.fetch_async",
417
 
                return_value=succeed("hash-ids"))
 
417
                return_value=succeed(b"hash-ids"))
418
418
    def test_fetch_hash_id_db_with_default_url(self, mock_fetch_async):
419
419
        # Let's say package_hash_id_url is not set but url is
420
420
        self.config.data_path = self.makeDir()
507
507
        return result
508
508
 
509
509
    @mock.patch("landscape.package.reporter.fetch_async",
510
 
                return_value=succeed("hash-ids"))
 
510
                return_value=succeed(b"hash-ids"))
511
511
    def test_fetch_hash_id_db_with_custom_certificate(self, mock_fetch_async):
512
512
        """
513
513
        The L{PackageReporter.fetch_hash_id_db} method takes into account the