def test__fetch_agent_locally_with_deps_positive(self, *mocks): """Test for fetch_agent_locally method with deps positive result.""" click_context_mock = ContextMock() ctx_mock = ContextMock(connections=["1"], protocols=["2"], skills=["3"]) _fetch_agent_locally(ctx_mock, PublicIdMock(), click_context_mock) click_context_mock.invoke.assert_called()
def test__fetch_agent_locally_with_deps_positive(self, *mocks): """Test for fetch_agent_locally method with deps positive result.""" public_id = PublicIdMock.from_str("author/name:0.1.0") ctx_mock = ContextMock( connections=[public_id], protocols=[public_id], skills=[public_id], contracts=[public_id], ) _fetch_agent_locally(ctx_mock, PublicIdMock())
def test_fetch_agent_locally_positive( self, exists_mock, try_to_load_agent_config_mock, _try_get_item_source_path_mock, join_mock, copy_tree, ): """Test for fetch_agent_locally method positive result.""" _fetch_agent_locally(ContextMock(), PublicIdMock(), ContextMock()) copy_tree.assert_called_once_with("path", "joined-path")
def test__fetch_agent_locally_with_deps_fail(self, *mocks): """Test for fetch_agent_locally method with deps ClickException catch.""" public_id = PublicIdMock.from_str("author/name:0.1.0") ctx_mock = ContextMock( connections=[public_id], protocols=[public_id], skills=[public_id], contracts=[public_id], ) with self.assertRaises(ClickException): _fetch_agent_locally(ctx_mock, PublicIdMock())
def test__fetch_agent_locally_with_deps_sys_exit(self, *mocks): """Test for fetch_agent_locally method with deps system exit catch.""" click_context_mock = ContextMock() click_context_mock.invoke = _raise_sys_exit ctx_mock = ContextMock(connections=["1"]) _fetch_agent_locally(ctx_mock, PublicIdMock(), click_context_mock)
def test_fetch_agent_locally_already_exists(self, *mocks): """Test for fetch_agent_locally method agent already exists.""" with self.assertRaises(ClickException): _fetch_agent_locally(ContextMock(), PublicIdMock(), ContextMock())
def test_fetch_agent_locally_incorrect_version(self, *mocks): """Test for fetch_agent_locally method incorrect agent version.""" with self.assertRaises(ClickException): _fetch_agent_locally(ContextMock(), PublicIdMock())
def test_fetch_agent_locally_positive(self, copy_tree, *mocks): """Test for fetch_agent_locally method positive result.""" _fetch_agent_locally(ContextMock(), PublicIdMock(), alias="some-alias") copy_tree.assert_called_once_with("path", "joined-path")