# ask-community

Adrian Pachzelt

02/09/2024, 9:33 AM
Dear Dagsterians, I am currently struggling in testing my application. I have several assets that have a key_prefix defined. When I want to materialize multiple (upstream and downstream) assets, I would use "materialize_to_memory". However, due to the key_prefix, Dagster does not find the mock ressources provided. How do I need to define the "ressources" attribute so that it knows that "raw" is the key_prefix and "foo_input" the ressource to mock? Example code with only one asset (but in my tests there would be multiple assets to be called including their mock ressources):
def foo(foo_input):
return "foo" + foo_input
def test_assets_require_service():
result = materialize_to_memory(
"raw.foo_input": mock.MagicMock(),  # this does not work to mock the input of the asset
assert result.success