Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def test_entities_update(self):
# Clean up managers
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
config = ActorRuntime.get_actor_config()
with self.assertRaises(ValueError):
config._entities.index(FakeSimpleActor.__name__)
_run(ActorRuntime.register_actor(FakeSimpleActor))
config = ActorRuntime.get_actor_config()
self.assertTrue(config._entities.index(FakeSimpleActor.__name__) >= 0)
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def test_dispatch(self):
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
request_body = {
"message": "hello dapr",
}
test_request_body = self._serializer.serialize(request_body)
response = _run(ActorRuntime.dispatch(
FakeMultiInterfacesActor.__name__, 'test-id',
"ActionMethod", test_request_body))
self.assertEqual(b'"hello dapr"', response)
_run(ActorRuntime.deactivate(FakeMultiInterfacesActor.__name__, 'test-id'))
# Ensure test-id is deactivated
with self.assertRaises(ValueError):
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def test_entities_update(self):
# Clean up managers
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
config = ActorRuntime.get_actor_config()
with self.assertRaises(ValueError):
config._entities.index(FakeSimpleActor.__name__)
_run(ActorRuntime.register_actor(FakeSimpleActor))
config = ActorRuntime.get_actor_config()
self.assertTrue(config._entities.index(FakeSimpleActor.__name__) >= 0)
def test_dispatch(self):
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
request_body = {
"message": "hello dapr",
}
test_request_body = self._serializer.serialize(request_body)
response = _run(ActorRuntime.dispatch(
FakeMultiInterfacesActor.__name__, 'test-id',
"ActionMethod", test_request_body))
self.assertEqual(b'"hello dapr"', response)
_run(ActorRuntime.deactivate(FakeMultiInterfacesActor.__name__, 'test-id'))
# Ensure test-id is deactivated
with self.assertRaises(ValueError):