I have the following setup:
foo
foo
I've unit-tested calls to "foo" in project A, without using Celery at all, just foo(1,2,3)
and assert the result. I know that it works.
I've unit-tested that send_task in project B sends the right parameters.
What I'm not testing, and need your advise on is the integration between the two projects. I would like to have a unittest that would:
foo
function returned the expected result. It seems to be possible to hack this by using python's subprocess and parsing the output of the worker, but that's ugly. What's the recommended approach to unit-testing in cases like this? Any code snippet you could share? Thanks!
I'm not sure if it's worthwhile to explicitly test the transportation mechanism (i.e. the sending of the task parameters through celery) using a unit test. Personally, I would write my test as follows (can be split up in several unit tests):
Using this method, you will be able to test that
If necessary, you can still independently test the functioning of the transportation mechanism using a system test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With