Mocking

import unittest.mock as mock

simple example

# PLEASE READ ME: the path to the func is where it is called not defined,
# you do not need to ref the func calling it
@mock.patch("path to where func is called") # src.fileName.funcBeingCalled
def test_testName(mock_functionName):
	mock_functionName.return_value = 1
  assert mock_functionName() == 1
	

api request example

@mock.patch("requests.get")
def test_api(mock_get):
	mock_response = mock.Mock()
	mock_response.status_code = 200
	mock_response.json.return_value = {...}
	mock_get.return_value = mock_response
	data = myFunc()
	assert data == {...}