I have this code:
from src.fetchFunction.feed_data.factories import getPlatform
class VideoService:
def something(self):
pl = getPlatform()
now I want to mock the getPlatform in my test:
import unittest
from unittest.mock import patch
from unittest.mock import MagicMock
class FieldsDeciderTest(unittest.TestCase):
@patch('src.fetchFunction.feed_data.factories')
def test_get_single(self, factoriesMock):
factories.getPlatform = MagicMock(return_value={})
But this doesn't work properly, any idea how it should be done?
Thanks
Aucun commentaire:
Enregistrer un commentaire