Skip to content

Commit

Permalink
Test SnmpV3Form
Browse files Browse the repository at this point in the history
  • Loading branch information
lunkwill42 committed Nov 9, 2023
1 parent 75d62b1 commit 2bcd8d0
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/unittests/seeddb/management_profile_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from nav.web.seeddb.page.management_profile.forms import SnmpV3Form


class TestSnmpv3Form:
def test_when_seclevel_is_noauth_then_it_should_not_require_auth_password(self):
form = SnmpV3Form(
dict(
sec_level="noAuthNoPriv",
auth_protocol="MD5",
sec_name="foo",
auth_password="",
)
)
assert form.is_valid()

def test_when_seclevel_is_auth_then_it_should_require_auth_password(self):
form = SnmpV3Form(
dict(
sec_level="authNoPriv",
auth_protocol="MD5",
sec_name="foo",
auth_password="",
)
)
assert not form.is_valid()

def test_when_seclevel_is_priv_then_it_should_require_priv_password(self):
form = SnmpV3Form(
dict(
sec_level="authPriv",
auth_protocol="MD5",
sec_name="foo",
auth_password="bar",
)
)
assert not form.is_valid()

def test_when_seclevel_is_priv_then_it_should_accept_priv_password(self):
form = SnmpV3Form(
dict(
sec_level="authPriv",
auth_protocol="MD5",
sec_name="foo",
auth_password="bar",
priv_password="cromulent",
)
)
assert form.is_valid()

0 comments on commit 2bcd8d0

Please sign in to comment.