b5eb940cf734a1c379f46051a67bd76895f756b6,tests/python/pants_test/net/http/test_fetcher.py,FetcherTest,test_checksum_listener,#FetcherTest#,112

Before Change



  def test_checksum_listener(self):
    digest = self.mox.CreateMockAnything()
    for chunk in self.expect_get("http://baz", chunk_size_bytes=1, timeout_secs=37):
      self.listener.recv_chunk(chunk)
      digest.update(chunk)

    self.listener.finished()
    digest.hexdigest().AndReturn("42")

    self.response.close()

After Change


    digest.hexdigest.return_value = "42"
    checksum_listener = Fetcher.ChecksumListener(digest=digest)

    with self.expect_get("http://baz",
                         chunk_size_bytes=1,
                         timeout_secs=37) as (chunks, expected_listener_calls):

      self.fetcher.fetch("http://baz",
                         checksum_listener.wrap(self.listener),
                         chunk_size_bytes=1,
                         timeout_secs=37)

    self.assertEqual("42", checksum_listener.checksum)

    def expected_digest_calls():
      for chunk in chunks:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: pantsbuild/pants
Commit Name: b5eb940cf734a1c379f46051a67bd76895f756b6
Time: 2016-08-09
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/net/http/test_fetcher.py
Class Name: FetcherTest
Method Name: test_checksum_listener


Project Name: pantsbuild/pants
Commit Name: b5eb940cf734a1c379f46051a67bd76895f756b6
Time: 2016-08-09
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/net/http/test_fetcher.py
Class Name: FetcherTest
Method Name: test_get


Project Name: pantsbuild/pants
Commit Name: b5eb940cf734a1c379f46051a67bd76895f756b6
Time: 2016-08-09
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/net/http/test_fetcher.py
Class Name: FetcherTest
Method Name: test_download_listener