示例#1
0
    def test_good_macs(self, session, host, mac):
        interface = Interface(host=host)
        assert object_state(interface).transient

        interface.mac = mac
        session.add(interface)
        session.flush()
示例#2
0
    def test_bad_macs(self, session, host, mac):
        interface = Interface(host=host)
        assert object_state(interface).transient

        with pytest.raises(InvalidMACAddressException):
            interface.mac = mac
        with pytest.raises(IntegrityError):
            session.add(interface)
            session.flush()