Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
openid.module
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Apr 2008 at 15:22 UTC
Updated:
22 May 2009 at 21:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
catchMoving to tests.
Comment #2
boombatower commentedI need to re-evaluate this, but I couldn't write tests before because of this http://drupal.org/node/244652.
Comment #3
walkah commentedclaiming this one
Comment #4
webchickBump. We really do need some sort of baseline tests for this functionality ASAP. It's causing regressions, like for example at #287178: Use hook_form_FORM_ID_alter() where possible.
Comment #5
c960657 commentedThis patch adds a dummy OpenID provider that is used for testing, as well as some unit tests for the internal functions. The code coverage is not 100%, but at least it's now more than 0% :-) The dummy provider probably needs to be extended a bit in order to support all aspects of the OpenID protocol.
Comment #6
boombatower commentedWe should include chx in on this dicussed as we have discussed this numerous times.
Comment #7
c960657 commentedNow also tests account registration using OpenID. More tests should probably be added in #216101: OpenID fails to auto-register account: Username invalid, email required.
I haven't included a test for account registration when user_email_verificication is TRUE, because this currently doesn't work properly due to #395340: Email verification not enforced with OpenID auto-registration.
Comment #9
c960657 commentedThe patch currently fails testing due to regressions introduced by #347250: Multiple load users and #322344: (notice) Form improvements from Views.
Comment #10
webchickWow. Let's hurry up and get these in so we stop doing that. :)
Comment #11
c960657 commentedPatch updated to use the new user_load_by_name(). Still waiting for #322344: (notice) Form improvements from Views to land.
Comment #12
chx commentedComment #14
c960657 commentedReroll. chx helped on IRC with the regression from #322344.
Comment #15
damien tournoud commentedThis is a very impressive patch, c960657. Nothing to add. A very good base on the road to have a fully tested OpenID implementation ;)
Comment #16
chx commentedCongratulations!
You wrote an openid test provider in this few lines of code, unbelievable!
Comment #17
webchickOh. My. God. c960657, you are my *hero*!
So I really really really really want this in so we can stop breaking OpenID every 2 months, but because it's a very tweaky area that few (as in like you and walkah :P) understand, and because this test doubles as wonderful documentation about how it's supposed to work, I'm going to be a bit harsh on documentation requirements, etc. This is not to be a pain in the ass -- well ok, maybe a little bit ;) -- but because I care. :)
*cracks knuckles* (note: I read patches I don't understand backwards; sorry)
My main thing is let's get a summary line of comments for every 4-5 lines of patch. This makes the code more scannable to people who don't care about (or would be lost in) the details and just want an overview of what's going on. For example:
(replace the silly things with actual things :P)
The goal is definitely NOT to repeat the OpenID spec verbatim, but merely to provide enough details that someone can follow along with the code. Right now, I'm completely lost, which means other people will be too. If we can document this to the point that an idiot like me can understand it, suddenly we could end up with many more people who could help with OpenID patches.
Functions that need this treatment include:
- _openid_test_endpoint_associate()
- _openid_test_endpoint_authenticate()
- testOpenidSignature()
- testCreateAccountWithoutEmailVerification()
- testLogin()
- testDeleteIdentity() - and should that just be testDelete() to match testLogin()?
That's cute and all, but is this part of the spec? If not, could we make this something more descriptive?
Please, please can we expand this out with an overview of what the heck is going on in this file? I would love 2-3 paragraphs of text that summarize "This module exposes blargdy flargs to in order to test the smurfing and the smooching of the OpenID smarfleblatz. A typical request goes like... etc."
Minor: that $Id$ line should be immediately after the php tag.
There's also no @file declaration here, but I notice we're lacking that on other .install files as well, so we'll clean that up and make them all consistent in a separate patch. Same thing with openid.test.
What a wonderful opportunity to explain to some poor schmuck what in the heck a Yardis is. :)
On another note, it looks like there's also some trailing whitespace that's introduced in this patch; Let's get rid of that as well.
Comment #18
c960657 commentedThanks for the praise, everybody :-)
This patch adds a lot of comments explaining what is going on with references to proper parts of the relevant specs. I hope this makes it easier to understand what is going on, though I have looked too much at the code today to tell whether I missed something fundamental.
Comment #19
c960657 commentedComment #21
c960657 commentedOuch.
Comment #22
c960657 commentedDoxygen comments adjusted to follow coding guidelines (I was just made aware of these in another issue).
Comment #23
webchick<blink><marquee><font style="font-size: 98794893.8em">WOW!</font></marquee></blink> ;)
The comments in here are actually way more detailed than I was asking for, but that's not a bad thing at all. I'm fairly confident that with this, someone with OpenID spec knowledge but without Drupal knowledge could get a good sense of what's going on in here to add additional tests, as well as someone with Drupal knowledge but without OpenID spec knowledge could know where to look for more information if a piece of code they wrote broke tests in a particular area. I know I certainly understand this stuff much better now, than I did before I read this patch. :)
I noticed a couple of minor things reading through, and then I see no reason not to commit this. Sorry, this skips around quite a bit:
should be "requests"
Doesn't wrap at 80 chars. The (see ..) part could be moved to the block below.
First line should only be 80 chars. Could be shortened to just "Test openID auto-registration with email verification disabled."
Incidentally, after a quick grep, it turns out we use also 'e-mail' and not 'email' in documentation.
There are two spaces rather than one before that first concatenation operator.
There are a couple of lines that could use additional clarification, such as:
"User doesn't need special permissions; only the ability to log in."
"Load the front page to get the user login block."
(alternately, maybe this could drupalGet('user/login') to make it more clear what's happening, unless your specific intent is to test the login block.)
Hm. I wonder if it's possible for that to conflict with the global $user variable ever? Should we call it web_user or something for consistency with other tests, and to prevent an unfortunate accidental namespace collision?
Hm. That seems overly brittle. There's no kind of menu callback we can throw a drupalPost against?
Comment #24
recidive commentedI've re-rolled addressing webchick's points above.
Changed
to
Comment #25
dries commentedThis is awesome in every aspect. Great code, great documentation, much needed. Committed to CVS HEAD. Thanks! Stunning work, c960657.
Comment #26
boombatower commentedThe openid_test.module and related files should be placed in the tests/ folder under openid, per #383600: Move tests into subdirectory.
Comment #27
c960657 commentedThis patch moves the files.
Comment #28
dries commentedCommitted. Thanks.