File: test_misc.py

package info (click to toggle)
python-socks 2.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 544 kB
  • sloc: python: 5,191; sh: 8; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# noinspection PyPackageRequirements
import pytest

from python_socks._helpers import is_ip_address  # noqa
from python_socks._protocols.http import BasicAuth  # noqa


@pytest.mark.parametrize('address', ('::1', b'::1', '127.0.0.1', b'127.0.0.1'))
def test_is_ip_address(address):
    assert is_ip_address(address)


def test_basic_auth():
    login = 'login'
    password = 'password'

    auth1 = BasicAuth(login=login, password=password)
    auth2 = BasicAuth.decode(auth1.encode())

    assert auth2.login == login
    assert auth2.password == password