Javex / libscep

Implementation of the SCEP protocol in C for both client and server
6 stars 8 forks source link

Refactor tests #42

Closed Javex closed 9 years ago

Javex commented 9 years ago

Some unwrapping properties are common to all or a subset of the available message types (e.g. transaction ID). In this case, we want to test that it works on all of them. Thus we need to refactor the tests in such a way that those properties can be tested on all of them without copying our test code over.

Javex commented 9 years ago

We should be refactoring all tests, split them up and organize them more nicely.

On that note: We should split unwrapping tests each with their corresponding operation. That is, each message, e.g. PKCSReq gets its own set of unwrapping functions. Addtionally, we have common unwrapping tests just we have with wrapping now. This way, unwrapping is tests for each function just as we test wrapping.

Javex commented 9 years ago

Another note on the splitting: There are two possible ways to split the unwrap:

In either case we have to notice that CertRep has a lot of work to do: It is able to build a multitude of response to each request, i.e. PKCSReq, GetCert, etc. And might need tests for all those cases separately. And unwrapping is the same: Unwrapping a response needs to test each CertRep case.

I strongly favor the first case as it makes testing a lot easier: You can built the message using the functions you are already testing (and have your make_message there for you to perform this part already).