File: test_auth_priv_v3.py

package info (click to toggle)
python-ezsnmp 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,256 kB
  • sloc: cpp: 3,746; python: 1,987; javascript: 1,110; makefile: 17; sh: 12
file content (83 lines) | stat: -rw-r--r-- 2,115 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from __future__ import unicode_literals

from ezsnmp.session import Session


def test_v3_authentication_md5_privacy_des(sess_v3_md5_des):
    s = Session(**sess_v3_md5_des)

    assert s.auth_password == "auth_pass"
    assert s.auth_protocol == "MD5"
    assert s.privacy_password == "priv_pass"
    assert s.privacy_protocol == "DES"

    res = s.get("sysDescr.0")

    assert res.oid == "sysDescr"
    assert res.oid_index == "0"
    assert res.snmp_type == "OCTETSTR"
    del s


def test_v3_authentication_md5_privacy_aes(sess_v3_md5_aes):
    s = Session(**sess_v3_md5_aes)

    assert s.auth_password == "auth_pass"
    assert s.auth_protocol == "MD5"
    assert s.privacy_password == "priv_pass"
    assert s.privacy_protocol == "AES"

    res = s.get("sysDescr.0")

    assert res.oid == "sysDescr"
    assert res.oid_index == "0"
    assert res.snmp_type == "OCTETSTR"
    del s


def test_v3_authentication_sha_privacy_aes(sess_v3_sha_aes):
    s = Session(**sess_v3_sha_aes)

    assert s.auth_password == "auth_second"
    assert s.auth_protocol == "SHA"
    assert s.privacy_password == "priv_second"
    assert s.privacy_protocol == "AES"

    res = s.get("sysDescr.0")

    assert res.oid == "sysDescr"
    assert res.oid_index == "0"
    assert res.snmp_type == "OCTETSTR"
    del s


def test_v3_authentication_sha_no_priv(sess_v3_sha_no_priv):
    s = Session(**sess_v3_sha_no_priv)

    assert s.auth_password == "auth_second"
    assert s.auth_protocol == "SHA"
    assert s.privacy_password == ""
    assert s.privacy_protocol == "DEFAULT"

    res = s.get("sysDescr.0")

    assert res.oid == "sysDescr"
    assert res.oid_index == "0"
    assert res.snmp_type == "OCTETSTR"
    del s


def test_v3_authentication_md5_no_priv(sess_v3_md5_no_priv):
    s = Session(**sess_v3_md5_no_priv)

    assert s.auth_password == "auth_pass"
    assert s.auth_protocol == "MD5"
    assert s.privacy_password == ""
    assert s.privacy_protocol == "DEFAULT"

    res = s.get("sysDescr.0")

    assert res.oid == "sysDescr"
    assert res.oid_index == "0"
    assert res.snmp_type == "OCTETSTR"
    del s