def setUp(self): tag = tags.VlanTag() value = 50 value2 = 100 invalid_value = 5000 super(TestVlanTag, self).setUp(tag=tag, value=value, value2=value2, invalid_value=invalid_value)
def test_create_port_sets_vlan_tag(self): self.context.session.add = mock.Mock() port_req = {"id": 1, "network_id": "2", "vlan_id": 1} new_port = db_api.port_create(self.context, **port_req) self.assertEqual(new_port.tags, [tags.VlanTag().serialize(1)])
def test_update_port_sets_vlan_tag(self): self.context.session.add = mock.Mock() mock_port = models.Port(id=1, network_id="2", ip_addresses=[], tags=[]) db_api.port_update(self.context, mock_port, vlan_id=1) self.assertEqual(mock_port.tags, [tags.VlanTag().serialize(1)])