Implemented SheerkaOntology

This commit is contained in:
2021-01-11 15:36:03 +01:00
parent e3c2adb533
commit e26c83a825
119 changed files with 6876 additions and 2002 deletions
+21 -2
View File
@@ -1,3 +1,5 @@
import pytest
from core.sheerka.services.SheerkaEventManager import SheerkaEventManager
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
@@ -44,7 +46,7 @@ example_of_class_method. event=xxx
"""
service = sheerka.services[SheerkaEventManager.NAME]
service.reset_topic(topic)
service.test_only_reset_topic(topic)
def test_i_can_subscribe_and_publish_with_data(self, capsys):
sheerka, context = self.init_concepts()
@@ -63,4 +65,21 @@ example_of_class_method. event=xxx, data='42'
"""
service = sheerka.services[SheerkaEventManager.NAME]
service.reset_topic(topic)
service.test_only_reset_topic(topic)
def test_i_can_save_and_reset_state(self):
sheerka, context = self.init_concepts()
service = sheerka.services[SheerkaEventManager.NAME]
sheerka.subscribe("my first topic", self.example_of_class_method_with_data)
sheerka.push_ontology(context, "new ontology")
sheerka.subscribe("my second topic", self.example_of_class_method_with_data)
# I can access to the topic
assert "my first topic" in service.subscribers
assert "my second topic" in service.subscribers
sheerka.pop_ontology()
assert "my first topic" in service.subscribers
assert "my second topic" not in service.subscribers