Skip to content

Commit

Permalink
Add OUI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed May 3, 2024
1 parent 4ae247c commit 076cde1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/integration/models/oui_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

from nav.models.oui import OUI


class TestOUI:
def test_should_give_error_if_less_than_6_characters(self):
with pytest.raises(ValueError):
OUI(oui="AABB", vendor="myvendor")

def test_should_give_error_if_morethan_6_characters(self):
with pytest.raises(ValueError):
OUI(oui="AABBCCDD", vendor="myvendor")

def test_should_allow_oid_with_6_characters(self):
OUI(oui="AABBCC", vendor="myvendor")

def test_string_representation_should_match_oid(self):
oui_string = "AABBCC"
oui = OUI(oui=oui_string, vendor="myvendor")
assert str(oui) == oui_string

0 comments on commit 076cde1

Please sign in to comment.