From 076cde1b29b9c7e9a57ccd3717e6ddbfb5eb08f6 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Fri, 3 May 2024 10:49:51 +0200 Subject: [PATCH] Add OUI tests --- tests/integration/models/oui_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/integration/models/oui_test.py 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