File: test_md5.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-- 567 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', [
    'd41d8cd98f00b204e9800998ecf8427e',
    'D41D8CD98F00B204E9800998ECF8427E'
])
def test_returns_true_on_valid_md5(value):
    assert validators.md5(value)


@pytest.mark.parametrize('value', [
    'z41d8cd98f00b204e9800998ecf8427e',
    'z8cd98f00b204e9800998ecf8427e',
    'z4aaaa1d8cd98f00b204e9800998ecf8427e'
])
def test_returns_failed_validation_on_invalid_md5(value):
    result = validators.md5(value)
    assert isinstance(result, validators.ValidationFailure)