def test_constructor_defaults(self): download = _download.DownloadBase(EXAMPLE_URL) assert download.media_url == EXAMPLE_URL assert download._stream is None assert download.start is None assert download.end is None assert download._headers == {} assert not download._finished _check_retry_strategy(download)
def test_finished_property(self): download = _download.DownloadBase(EXAMPLE_URL) # Default value of @property. assert not download.finished # Make sure we cannot set it on public @property. with pytest.raises(AttributeError): download.finished = False # Set it privately and then check the @property. download._finished = True assert download.finished
def test_constructor_explicit(self): start = 11 end = 10001 headers = {u'foof': u'barf'} download = _download.DownloadBase(EXAMPLE_URL, stream=mock.sentinel.stream, start=start, end=end, headers=headers) assert download.media_url == EXAMPLE_URL assert download._stream is mock.sentinel.stream assert download.start == start assert download.end == end assert download._headers is headers assert not download._finished _check_retry_strategy(download)