*** didymo has joined #schooltool | 00:44 | |
*** th1a_ has joined #schooltool | 03:13 | |
*** th1a has quit IRC | 03:16 | |
*** th1a_ has quit IRC | 05:54 | |
*** didymo has quit IRC | 06:13 | |
*** th1a has joined #schooltool | 06:49 | |
*** aelkner_ has joined #schooltool | 07:44 | |
*** aelkner__ has quit IRC | 08:01 | |
*** didymo has joined #schooltool | 08:18 | |
*** Ninno has joined #schooltool | 08:23 | |
*** Ninno has quit IRC | 08:24 | |
*** tdoggette has joined #schooltool | 13:40 | |
*** alga has joined #SchoolTool | 13:43 | |
*** ignas has joined #schooltool | 14:07 | |
*** tdoggette has quit IRC | 15:14 | |
*** didymo has quit IRC | 15:22 | |
*** ignas has quit IRC | 15:39 | |
*** ignas has joined #schooltool | 15:46 | |
*** mgedmin has joined #schooltool | 16:01 | |
*** tdoggette has joined #schooltool | 16:19 | |
*** alga has quit IRC | 16:25 | |
th1a | Lumiere: How many schools are using CanDo now and how many are planned for next year? | 16:32 |
---|---|---|
*** alga has joined #SchoolTool | 17:00 | |
*** tdoggette has quit IRC | 17:21 | |
aelkner_ | hey ignas | 17:56 |
th1a | How's it coming aelkner_? | 18:00 |
aelkner_ | not bad | 18:00 |
aelkner_ | i have the test framework up and have tested some of the moethods | 18:00 |
th1a | Good. | 18:00 |
aelkner_ | i wanted ignas' thoughts on one issue | 18:00 |
th1a | When does the school year end at SLA? | 18:00 |
aelkner_ | namely, the authenticate method needs to contact the CAS server with a urlopn call | 18:01 |
aelkner_ | i think i'll need to replace that with a utility | 18:01 |
aelkner_ | and the test will supply a dummy response | 18:01 |
th1a | Yes. | 18:01 |
aelkner_ | it could return yes for one user and no for another | 18:01 |
aelkner_ | that would excersize the different paths through authenticate | 18:02 |
th1a | Yeah. That's what you want. | 18:02 |
aelkner_ | the school year at SLA? | 18:04 |
aelkner_ | i don't know the exact date | 18:04 |
th1a | Roughly? | 18:04 |
aelkner_ | chris told me i didn't need to come | 18:04 |
aelkner_ | weds anymore | 18:04 |
aelkner_ | i'm guessing this week or next | 18:04 |
th1a | Ah, ok. | 18:04 |
ignas | aelkner_: seems to make sense | 18:16 |
aelkner_ | i'll utility will have a validate method that receives the requrl | 18:17 |
aelkner_ | the live one will do the urlopen, read, and split | 18:17 |
aelkner_ | and return the result | 18:17 |
ignas | can't tell without seeing the actual code, sorry | 18:17 |
aelkner_ | if you look at the authenticate method as you have it | 18:18 |
aelkner_ | i'm replacing the urlopen line with | 18:18 |
aelkner_ | result = getUtility(ICASValidate).validate(requrl) | 18:18 |
ignas | makes sense I guess | 18:19 |
aelkner_ | the fake utility can return ['yes', 'frog'] for ticket 'good_ticket' | 18:19 |
aelkner_ | and ['no', ''] for any other ticket | 18:19 |
ignas | maybe you should come up with a better abstraction? | 18:20 |
ignas | like return None or user itself | 18:20 |
ignas | for example | 18:20 |
ignas | the utility should do the yes/no checking | 18:20 |
ignas | and return either None or the principal | 18:20 |
aelkner_ | but then we don't have an ability to unit test | 18:20 |
aelkner_ | that's why i want to abstract only the interaction with the server | 18:20 |
ignas | we have, you can just overlay the methof | 18:20 |
ignas | that does urlopen | 18:20 |
aelkner_ | and let our code that parses the result | 18:21 |
ignas | that would be in the utility | 18:21 |
aelkner_ | oh | 18:21 |
aelkner_ | so in my test, i create an instance of the live utility | 18:22 |
aelkner_ | replace it's open method with a fake one | 18:22 |
aelkner_ | that returns ['yes', 'frog'] | 18:22 |
ignas | yeah, something like that would do | 18:22 |
ignas | maybe not a list | 18:22 |
aelkner_ | but the validate method returns the princiapal | 18:22 |
ignas | but a string | 18:22 |
ignas | leave the "splitting" part to the rest of the code | 18:23 |
ignas | either the principal | 18:23 |
ignas | or the id | 18:23 |
ignas | or you can just make a method that does the urlopen | 18:23 |
ignas | in the CAS utility | 18:23 |
ignas | and overlay *that* method | 18:23 |
ignas | instead of adding one more utility | 18:23 |
aelkner_ | ah, yes | 18:23 |
aelkner_ | even simpler | 18:24 |
aelkner_ | so to reitterate | 18:29 |
aelkner_ | i'm going to replace | 18:29 |
aelkner_ | result = urllib.urlopen(requrl).read().split('\n') | 18:29 |
aelkner_ | with | 18:29 |
aelkner_ | contactResult = self.contactCAS(requrl) | 18:30 |
aelkner_ | result = contactResult.split("\n") | 18:30 |
aelkner_ | and create method | 18:30 |
aelkner_ | def contactCAS(self, requrl): | 18:30 |
aelkner_ | return urllib.urlopen(requrl).read() | 18:30 |
aelkner_ | then i overlay that method in my test | 18:30 |
aelkner_ | with a method that returns 'yes\nfrog' | 18:31 |
aelkner_ | for good_ticket | 18:31 |
aelkner_ | and 'no\n'' for bad_ticket | 18:31 |
aelkner_ | ignas: does that sound right? | 18:31 |
ignas | contactCAS is a bit too abstract as a name | 18:47 |
ignas | i | 18:47 |
ignas | i'd just call it _urlopen | 18:47 |
ignas | with a docstring of "hook for unit tests" for example | 18:47 |
ignas | but it works i guess ... | 18:47 |
*** tdoggette has joined #schooltool | 18:49 | |
aelkner_ | ignas: cold you explain me something you did in authenticate? | 19:53 |
aelkner_ | i have one path through the method to test, when ticket is not set, but CAS is | 19:54 |
aelkner_ | it calls storeCredentials(request, None) | 19:55 |
aelkner_ | which sets the authenticated value to True in session, but does nothing to the principal | 19:56 |
aelkner_ | what is the thinking here? | 19:56 |
aelkner_ | i need to know in order come up with a narrative for my test | 19:57 |
ignas | well | 20:02 |
ignas | there is a usecase for "anonymous" user | 20:02 |
ignas | someone who is "nobody" | 20:02 |
ignas | so that you could see school calendar for example | 20:02 |
ignas | even with CAS enabled | 20:02 |
ignas | even though you don't have CAS login | 20:02 |
*** ignas has quit IRC | 21:35 | |
*** aelkner__ has joined #schooltool | 22:20 | |
*** aelkner_ has quit IRC | 22:22 | |
*** tdoggette has quit IRC | 22:24 | |
*** mgedmin has quit IRC | 22:34 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!