import hashlib
from django.core.files.base import ContentFile
from django.core.files.storage import Storage


def test_checksum(faker, storage: Storage):
    name = faker.file_name()
    sentence = bytes(faker.sentence(), 'utf-8')
    content = ContentFile(sentence)
    storage.save(name, content)
    h = hashlib.sha256()
    h.update(sentence)
    expected_sha256 = h.hexdigest()
    actual_sha256 = storage.sha256_checksum(name)
    assert actual_sha256 == expected_sha256

cd965e24887a8bc7ff1fecc8caae687505051da0
<mask token>

<mask token>


def test_checksum(faker, storage: Storage):
    name = faker.file_name()
    sentence = bytes(faker.sentence(), 'utf-8')
    content = ContentFile(sentence)
    storage.save(name, content)
    h = hashlib.sha256()
    h.update(sentence)
    expected_sha256 = h.hexdigest()
    actual_sha256 = storage.sha256_checksum(name)
    assert actual_sha256 == expected_sha256

import hashlib
from django.core.files.base import ContentFile
from django.core.files.storage import Storage


def test_checksum(faker, storage: Storage):
    name = faker.file_name()
    sentence = bytes(faker.sentence(), 'utf-8')
    content = ContentFile(sentence)
    storage.save(name, content)
    h = hashlib.sha256()
    h.update(sentence)
    expected_sha256 = h.hexdigest()
    actual_sha256 = storage.sha256_checksum(name)
    assert actual_sha256 == expected_sha256
