Closed HosseyNJF closed 4 years ago
I have a couple of changes I want to make anyway before merging so I'm fixing these while making those but feedback for next time:
mock.patch
in a test function, the bottom-most patch comes first in the function argument list, and the top-most last.Also, you're prior comment about this docstring causing unittest issues:
"""Generator to return the next value in a list of values on every call.
>>> vals = gen_mock_values([1, 2, 3])
>>> mocked_func.side_effect = lambda: next(vals)
>>> mocked_func()
1
>>> mocked_func()
2
"""
I managed to reproduce, I'm guessing you're using PyCharm and clicking the play button to the left of the class definition. PyCharm gets it wrong and tries to run doctests instead of unittests, which obviously fail. Either you need to manually change the config after clicking the play and seeing it fail once or just manually set up a full unittest runner in the PyCharm run config.
Aside from all that feedback, thanks for the effort you put in. Pulling the parsing out to the models is definitely a good idea!
If the deserialization process of OpenVPN's output gets done inside the model, It would be easily testable and extendable.