I wrote some basic functional tests for the module.
For more in-depth testing, it would be good to have two sites, one provider and one "client" site.

CommentFileSizeAuthor
openid_provider_test.patch3.58 KBAron Novak
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anarcat’s picture

Title: Functional testing » Unit testing

Isn't this more unit than functional tests?

What coverage are we aiming at now?

Aron Novak’s picture

Sorry, i wrote nonsense, these are unit tests, not functional tests, of course :)
Coverage, well, i tried to test as many places as possible, some functions cannot be really tested because of the lack of the client part.

anarcat’s picture

Well, that was what i was wondering: can we test the client part? There are things like http://openidenabled.com/resources/openid-test/diagnose-server/ that can do that...

Aron Novak’s picture

Well, i think this is a problematic question. This means that you
1) could not test without network connection (however it's not common, but possible, servers behind strict firewall)
2) tests will fail if network fail - you have to find out where is the problem

anarcat’s picture

Well, tests could be local: we could use the openid.module to do tests against the openid_provider.module. It would be hard because you have to reproduce the behaviour of the web browser but it's possible.

I don't think this idea should block this patch however, which looks nice to me (but I haven't tested it).

anarcat’s picture

Status: Needs review » Needs work

I have committed the patch, but it needs some more love. First there's already a test that fails, maybe because of recent changes to the code:

DH public has correct length.	Other	openid_provider.test	65	OpenIDProviderTestCase->testOpenIDProviderDHAssoc()	

Second, there are a bunch of warnings like this:

Starting run with db_prefix simpletest767840	System	openid_provider.test	10	OpenIDProviderTestCase->setUp()	
Table 'idorangeseedsorg.simpletest767840variable' doesn't exist query: UPDATE simpletest767840variable SET value = 's:4:\"/tmp\";' WHERE name = 'file_directory_temp'	User warning	database.mysqli.inc	135	_db_query()	
Table 'idorangeseedsorg.simpletest767840cache' doesn't exist query: DELETE FROM simpletest767840cache WHERE cid = 'variables'	User warning	database.mysqli.inc	135	_db_query()	

... every time a test is setup.

anarcat’s picture

Note that I have submitted a few tests upstream to Drupal core's functions. See #1419768: import tests from openid_provider module for followup.

I guess the next step here would be to test logins...

anarcat’s picture

Status: Needs work » Fixed

let's close this for now, unit tests exist, they need to be expanded, but we can work on that later, it's not a blocker for anything, and people wishing to scratch an itch will do so.

Actually, i have opened #1843514: unit test login procedures for this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.