diff --git a/tests/integration/models/oui_test.py b/tests/integration/models/oui_test.py new file mode 100644 index 0000000000..ee3364b419 --- /dev/null +++ b/tests/integration/models/oui_test.py @@ -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