def test_rate_limit_unique_key(self):
        req = RequestFactory().post('/')
        req.user = User()
        req.user.pk = 1

        @ratelimit(rate='1/m')
        def one(request):
            pass

        key_part = '%s.%s:user:%d' % (one.__module__, one.__name__, req.user.pk)
        key_hash = hashlib.sha1(key_part.encode('utf-8')).hexdigest()
        key = '%s:%s' % (settings.ST_RATELIMIT_CACHE_PREFIX, key_hash)

        one(req)
        rl_cache = caches[settings.ST_RATELIMIT_CACHE]
        self.assertIsNotNone(rl_cache.get(key))
Calculates a checksum with the provided algorithm.
dataset/ETHPy150Open nitely/Spirit/spirit/core/tests/tests_utils_ratelimit.py/UtilsRateLimitTests.test_rate_limit_unique_key--crossover with--dataset/ETHPy150Open dcramer/django-compositepks/django/contrib/localflavor/pl/forms.py/PLREGONField.has_valid_checksum