Whether there is something other than a management command to do this job, I don’t know.
I need to integrate an MQTT subscriber application which I wrote in Python into a Django project. That is I want to use models instead of using psycopg2 directly. The only way I know how to do this is with a management command, which is not difficult to put together, but trying to write tests is stumping me right now because the management command never terminates, except abnormally, as it would run as (or similar to) a daemon.
But I was thinking about how to use TestCase with it, and it seems I would have to run it as a subprocess or something, with some kind of synchronization so I could assert things here and there.
I’m familiar with unit tests with TestCase and functional tests with Selenium and LiveServerTestCase but haven’t found much along these lines.
I’m just looking for suggestions about where to look.
Cheers,
Chris