I have been trying to figure out how do I create a mock for an object I am initializing in the init method of the class. I have been using pytest and mockito to try and do the same, but with least amount of luck.
I have 2 questions here:
- How do I initialize the object i have defined in the init method
- If the object is a boto3 client, will mock work and is it the most efficient way
The code snipped I am trying to mock is as given below:
../glue.py
class GlueClient():
def __init__(self):
self.glue_client = boto3.client("glue")
def get_databases(self):
...
response = self.glue_client.get_databases(
NextToken=next_token
)
...
Could someone please help?