I am in need to mock a glue job to check if it exists for a unit test case. The following code is used for it.
class GlueJob:
"""Function mocking glue job."""
def custom_get_glue_job(self,glue_client):
"""Test Glue Job"""
response = glue_client.get_job(JobName="abc")
return response
import unittest
import sys
from unittest import mock
from mock import patch
class TestGlueJobs(unittest.TestCase):
"""Function mocking glue job"""
@patch.object(GlueJob, 'custom_get_glue_job',return_value=True)
def check_glue_job_exists(self, glue_job):
"""Function printing python version."""
session = boto3.session.Session()
glue_client = session.client('glue', region_name='us-west-1')
GlueJob.custom_get_glue_job(glue_client)
print("success")
glue_job = GlueJob
TestGlueJobs().check_glue_job_exists()
I am getting the following errors:
- No value for argument 'glue_client' in unbound method call
- No value for argument 'glue_job' in method call
I have passed on the values for both this argument. Not sure what I am missing here.
Thanks.