# Path: netman/core/objects/port_modes.py
# ACCESS = "ACCESS"


from hamcrest import assert_that, is_
from netman.core.objects.exceptions import UnknownInterface
from netman.core.objects.interface_states import ON, OFF
from netman.core.objects.port_modes import ACCESS
from tests.adapters.compliance_test_case import ComplianceTestCase
    def tearDown(self):
        self.janitor.remove_vlan(90)
        self.janitor.remove_bond(42)
        super(ResetInterfaceTest, self).tearDown()

    def test_reverts_trunk_vlans(self):
        self.try_to.add_vlan(90)

        self.try_to.set_trunk_mode(self.test_port)
        self.try_to.add_trunk_vlan(self.test_port, 90)

        self.client.reset_interface(self.test_port)

        assert_that(self.client.get_interface(self.test_port).trunk_vlans, is_(self.interface_before.trunk_vlans))

    def test_reverts_trunk_native_vlan(self):
        self.try_to.add_vlan(90)

        self.try_to.set_trunk_mode(self.test_port)
        self.try_to.set_interface_native_vlan(self.test_port, 90)

        self.client.reset_interface(self.test_port)

        assert_that(self.client.get_interface(self.test_port).trunk_native_vlan,
                    is_(self.interface_before.trunk_native_vlan))

    def test_reverts_port_mode(self):
        if self.interface_before.port_mode == ACCESS:
            self.try_to.set_trunk_mode(self.test_port)
        else:

# Path: netman/core/objects/port_modes.py
# ACCESS = "ACCESS"


# Path: tests/adapters/compliance_tests/reset_interface_test.py
from hamcrest import assert_that, is_
from netman.core.objects.exceptions import UnknownInterface
from netman.core.objects.interface_states import ON, OFF
from netman.core.objects.port_modes import ACCESS
from tests.adapters.compliance_test_case import ComplianceTestCase

    def tearDown(self):
        self.janitor.remove_vlan(90)
        self.janitor.remove_bond(42)
        super(ResetInterfaceTest, self).tearDown()

    def test_reverts_trunk_vlans(self):
        self.try_to.add_vlan(90)

        self.try_to.set_trunk_mode(self.test_port)
        self.try_to.add_trunk_vlan(self.test_port, 90)

        self.client.reset_interface(self.test_port)

        assert_that(self.client.get_interface(self.test_port).trunk_vlans, is_(self.interface_before.trunk_vlans))

    def test_reverts_trunk_native_vlan(self):
        self.try_to.add_vlan(90)

        self.try_to.set_trunk_mode(self.test_port)
        self.try_to.set_interface_native_vlan(self.test_port, 90)

        self.client.reset_interface(self.test_port)

        assert_that(self.client.get_interface(self.test_port).trunk_native_vlan,
                    is_(self.interface_before.trunk_native_vlan))

    def test_reverts_port_mode(self):
        if self.interface_before.port_mode == ACCESS:
            self.try_to.set_trunk_mode(self.test_port)
        else:

            self.try_to.set_access_mode(self.test_port)