[Grok-dev] Can't login in functional doctest

Lukas Zdych lukas.zdych at dms4u.cz
Mon Jan 26 15:38:16 EST 2009


Hi,

at first thx for your response. I started to debug whole authentication 
process and found my mistake which was right in the PrincipalAddForm's
join action:

...
principal = createObject(u'myproject.factory.principal', **data)
self.applyData(account, **data)
...

The first line of code calls my factory which creates new principal and 
in it's constructor calls:

...
self.password = self.setPassword(password) # this encodes plain password
...

The second line replaces my encoded password with plain one.

My silly mistake was ugly hack in the my_pricipal_class.checkPassword 
marked with comment: # FIXME bla bla bla..

It was workin' in the real browser because of that hack and not workin' 
in the test because there I didn't use the addform but the factory only.

So today I got a big lesson about coding and testing which I'm very 
happy about: TEST TEST and TEST any new code, any bug immediately

Thx for makin' me think :)

L.

Uli Fouquet wrote:
> Hi there,
> 
> Lukas Zdych wrote:
>> Hi, I have simple authentication setup similar to one explained here:
>>
>> http://grok.zope.org/documentation/how-to/authentication-with-grok
>>
>> .. and it works great. Unfortunately but I'm not able to authenticate 
>> through login form in the doctest using zope.testbrowser...
>>
>> I found (using pdb) that my authentication plugin doesn't get any 
>> credentials .. it seems I need some additional testbrowser setup .. any 
>> ideas would be nice.
> 
> That's unfortunately a rather unspecific description. What means
> 'similar to the HOWTO'? To begin with: what do you expect from which
> test and what do you get inststead? Did you grok your package in
> ftesting.zcml?
> 
> Best regards,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev


-- 

Lukas Zdych

www: http://dms4u.cz
email: lukas.zdych at dms4u.cz
email: info at dms4u.cz
tel: +420 775 171 325


More information about the Grok-dev mailing list