Hi there...can someone help me understand how I'm ...
# ask-community
b
Hi there...can someone help me understand how I'm supposed to mock a redshift resource for the purposes of testing? I'm using
Copy code
context = build_op_context(
            resources={
                "database": db,
                "s3": s3_resource.mock_resource("mock gather s3"),
            }
        )
to build the context for my test and need to add a mock redshift resource, but can't quite seem to get the setup right. Thanks!
p
Have you tried
ResourceDefinition.mock_resource()
? I've also had success doing it like this:
Copy code
s3_mock = MagicMock()
and then setting
s3_mock
in the resources dict
👍 1
c
The
s3_resource.mock_resource
call that you’re doing is just calling the class method
mock_resource
that Philip mentions above ^. It should be working to provide a mock in place of the resource, an alternative would be to just directly provide a mock. What issues are you running into with it?