Jamie- / openvpn-api

A Python API for the OpenVPN management interface.
MIT License
56 stars 19 forks source link

Move deserialization and parsing process to Models #7

Closed HosseyNJF closed 4 years ago

HosseyNJF commented 4 years ago

If the deserialization process of OpenVPN's output gets done inside the model, It would be easily testable and extendable.

Jamie- commented 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:

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!