예제 #1
0
    def test_hash_file(self):
        lc = CGILookasideCache('sha512', '_', '_')

        with open(self.filename, 'w') as f:
            f.write('something')

        result = lc.hash_file(self.filename, 'md5')
        self.assertEqual(result, '437b930db84b8079c2dd804a71936b5f')

        result = lc.hash_file(self.filename)
        self.assertEqual(
            result,
            '983d43ddff6da90f6a5d3b6172446a1ffe228b803fe64fdd5dcfab5646078a896851fe82f623c9d6e5654b3d2f363a04ec17cfb62b607437a9c7c132d511e522'
        )  # noqa
예제 #2
0
    def test_hash_file_empty(self):
        lc = CGILookasideCache('sha512', '_', '_')

        with open(self.filename, 'w') as f:
            f.write('')

        result = lc.hash_file(self.filename, 'md5')
        self.assertEqual(result, 'd41d8cd98f00b204e9800998ecf8427e')