AnemoneLabs / unmessage

Privacy enhanced instant messenger
GNU General Public License v3.0
43 stars 7 forks source link

Add a test suite #33

Closed felipedau closed 7 years ago

felipedau commented 7 years ago

unMessage needs a test suite (using pytest). Feedback from @david415 suggested adding fuzzing/property based tests as well (using hypothesis).

felipedau commented 7 years ago

Hi @david415 and @meejah, I added a few hypothesis tests for the functions that build unMessage's packets. As we do not yet have fixed a size for the packets, I am not sure if/how the size of the inputs should be fixed as well. (The changes are in #46)

While I was testing, I noticed that if I changed one of the conditionals which expected a packet to be built successfully, the test would still pass. Then I realized that as there are so many possible combinations for input, a correct set was never given and therefore it was always failing to build a packet, but correctly passing the test. What I did was making sure to at least test one correct set of inputs with @example. What do you think?

P.S. ~2 seconds to run these tests is a lot, but probably due to the inputs not having a fixed range.

Thanks!

felipedau commented 7 years ago

Hi @meejah, I recently created #72 with the integration tests and fixtures I wrote so far. What do you think? Can they be improved?

I recently talked to @david415 and he was positive about it. He also questioned the need of making a fixture for the reactor. I honestly just copied that from Tahoe-LAFS' integration tests, but that's probably not useful in our case here as that is only being used to create the Peer objects and maybe could be done with just a regular import in conftest.py. Is it worth it leaving that fixture just in case?

felipedau commented 7 years ago

Now that #45, #46, #72, #76 and #80 are merged, this task is complete.