mock.sentinel.port_id

Here are the examples of the python api mock.sentinel.port_id taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

View license
    def test_treat_devices_added_missing_port_id(self):
        self.agent._added_ports = set([mock.sentinel.port_id])
        details = {'device': mock.sentinel.port_id}
        attrs = {'get_devices_details_list.return_value': [details]}
        self.agent.plugin_rpc.configure_mock(**attrs)

        self.agent._treat_devices_added()

        self.assertNotIn(mock.sentinel.port_id, self.agent._added_ports)

Example 2

View license
    def test_treat_vif_port_sg_enabled(self):
        self.agent.enable_security_groups = True
        self._check_treat_vif_port_state_up()

        sg_agent = self.agent.sec_groups_agent
        sg_agent.refresh_firewall.assert_called_once_with(
            [mock.sentinel.port_id])

Example 3

View license
    def test_treat_devices_added_returns_true_for_missing_device(self):
        self.agent._added_ports = set([mock.sentinel.port_id])
        attrs = {'get_devices_details_list.side_effect': Exception()}
        self.agent.plugin_rpc.configure_mock(**attrs)
        self.agent._treat_devices_added()

        self.assertIn(mock.sentinel.port_id, self.agent._added_ports)

Example 4

View license
    def test_treat_vif_port_sg_disabled(self):
        self.agent.enable_security_groups = False
        self._check_treat_vif_port_state_up()
        self.agent._utils.remove_all_security_rules.assert_called_once_with(
            mock.sentinel.port_id)

Example 5

View license
    def test_process_added_port_event(self):
        self.agent._added_ports = set()
        self.agent._process_added_port_event(mock.sentinel.port_id)
        self.assertIn(mock.sentinel.port_id, self.agent._added_ports)

Example 6

View license
    def test_process_removed_port_event(self):
        self.agent._removed_ports = set([])
        self.agent._process_removed_port_event(mock.sentinel.port_id)
        self.assertIn(mock.sentinel.port_id, self.agent._removed_ports)

Example 7

Project: os-win
Source File: test_networkutils.py
View license
    def test_clear_port_sg_acls_cache(self):
        self.netutils._sg_acl_sds[mock.sentinel.port_id] = [mock.sentinel.acl]
        self.netutils.clear_port_sg_acls_cache(mock.sentinel.port_id)
        self.assertNotIn(mock.sentinel.acl, self.netutils._sg_acl_sds)