Could someone please let me know how to mock the DatabaseAPI object for below unit test case example. Getting error at getURL in test_load.py file.
File load.py
from database_api import DatabaseAPI
Database_api_client = DatabaseAPI(username, password)
def loadFile():
#some code to load the file
File database_api.py
class DatabaseAPI:
def __init__(self, username, password):
self.getUrl()
def getUrl(self):
requests.options(url=SomeURL, headers=request_header)
File test_load.py
import unittest
from load import loadFile
class TestLoad(unittest.TestCase):
def test_loadFile(self):
#some code to test loadfile
But getting get_url connection error. I need to mock the "Database_api_client = DatabaseAPI(username, password)" object
But getting get_url connection error. I need to mock the "Database_api_client = DatabaseAPI(username, password)" object