How can I use mocking to set each item in a list to whatever I want?

31 Views Asked by At

Here is my function that I want to write a unit test for:

def check_files_content(files_spec):
    for item in files_specs:
        do_something
        ....

Here is the unit test:

def test_check_files_content(): 
    check_files_content(MagicMock())??
    .... 

I don't know how to set up files_specs using MagicMock() so that I can set each item in files_specs to whatever I want, as we loop over the list.

Any ideas how this can be achieved?

0

There are 0 best solutions below