def test_priority(self, available_mocks): new_order = [NetplanActivator, NetworkManagerActivator] resp = search_activator(priority=new_order) assert resp == new_order activator = select_activator(priority=new_order) assert activator == new_order[0]
def test_none_available(self, unavailable_mocks): resp = search_activator() assert resp == [] with pytest.raises(RuntimeError): select_activator()
def test_priority_not_exist(self, available_mocks): with pytest.raises(ValueError): search_activator(priority=['spam', 'eggs']) with pytest.raises(ValueError): select_activator(priority=['spam', 'eggs'])
def test_first_not_available(self, m_available, available_mocks): resp = search_activator() assert resp == DEFAULT_PRIORITY[1:] resp = select_activator() assert resp == DEFAULT_PRIORITY[1]
def test_target(self, available_mocks): search_activator(target='/tmp') assert '/tmp' == available_mocks.m_which.call_args[1]['target'] select_activator(target='/tmp') assert '/tmp' == available_mocks.m_which.call_args[1]['target']
def test_defaults(self, available_mocks): resp = search_activator() assert resp == DEFAULT_PRIORITY activator = select_activator() assert activator == DEFAULT_PRIORITY[0]
def test_none_available(self, unavailable_mocks): resp = search_activator() assert resp == [] with pytest.raises(NoActivatorException): select_activator()
def test_target(self, available_mocks): search_activator(target="/tmp") assert "/tmp" == available_mocks.m_which.call_args[1]["target"] select_activator(target="/tmp") assert "/tmp" == available_mocks.m_which.call_args[1]["target"]