'Tests with mocking the pngcrush.'

@mock.patch('mkt.feed.views.pngcrush_image.delay')
@mock.patch('mkt.feed.views.requests.get')
def test_background_image(self, download_mock, crush_mock):

    res_mock = mock.Mock()
    res_mock.status_code = 200
    res_mock.content = open(os.path.join(FILES_DIR, 'bacon.jpg'), 'r').read()
    download_mock.return_value = res_mock
    self.feed_permission()
    data = dict(self.obj_data)
    data.update({'background_image_upload_url': 'ngokevin.com'})
    (res, data) = self.create(self.client, **data)
    coll = FeedCollection.objects.all()[0]
    eq_(coll.image_hash, 'e83ad266')
    ok_(data['background_image'].endswith(coll.image_hash))
    eq_(crush_mock.call_args_list[0][0][0], coll.image_path())
    eq_(crush_mock.call_args_list[0][1]['set_modified_on'][0], coll)
