File: test_sha256.py

package info (click to toggle)
validators 0.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 332 kB
  • sloc: python: 1,556; makefile: 150
file content (22 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- coding: utf-8 -*-
import pytest

import validators


@pytest.mark.parametrize('value', [
    'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
    'E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855'
])
def test_returns_true_on_valid_sha256(value):
    assert validators.sha256(value)


@pytest.mark.parametrize('value', [
    'z3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
    'ec44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
    'eaaaa3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
])
def test_returns_failed_validation_on_invalid_sha256(value):
    result = validators.sha256(value)
    assert isinstance(result, validators.ValidationFailure)