MCPcopy
hub / github.com/apache/caldera / test_learn

Method test_learn

tests/services/test_learning_svc.py:24–34  ·  view source on GitHub ↗
(self, setup_learning_service, learning_svc, knowledge_svc)

Source from the content-addressed store, hash-verified

22class TestLearningSvc:
23
24 async def test_learn(self, setup_learning_service, learning_svc, knowledge_svc):
25 operation, link, _ = setup_learning_service
26 operation.add_link(link)
27 all_facts = await operation.all_facts()
28 await learning_svc.learn(
29 facts=all_facts,
30 link=link,
31 blob=BaseWorld.encode_string('i contain 1 ip address 192.168.0.1 and one file /etc/host.txt. that is all.'))
32 knowledge_facts = await knowledge_svc.get_facts(dict(source=link.id))
33 assert len(link.facts) == 2
34 assert len(knowledge_facts) == 2
35
36 async def test_same_fact_different_agents(self, setup_learning_service, learning_svc, knowledge_svc):
37 operation, link1, link2 = setup_learning_service

Callers

nothing calls this directly

Calls 5

add_linkMethod · 0.80
encode_stringMethod · 0.80
all_factsMethod · 0.45
learnMethod · 0.45
get_factsMethod · 0.45

Tested by

no test coverage detected