The Trunk: NetworkTests-topa.14.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: NetworkTests-topa.14.mcz

commits-2
A new version of NetworkTests was added to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-topa.14.mcz

==================== Summary ====================

Name: NetworkTests-topa.14
Author: topa
Time: 4 May 2010, 2:39:48.697 pm
UUID: 2a994995-24ec-4835-8a77-7f97b2ef1ac7
Ancestors: NetworkTests-ar.13

Test Urls that might contain passwords/usernames with
"dangerous" characters.


=============== Diff against NetworkTests-ar.13 ===============

Item was added:
+ ----- Method: UrlTest>>testUsernamePasswordEncoded (in category 'tests') -----
+ testUsernamePasswordEncoded
+ "Sometimes, weird usernames or passwords are necessary in
+ applications, and, thus, we might receive them in a Url.
+ The @ and the : ar the kind of critical ones.
+ "
+
+ #( "('user' 'pword' 'host' port 'path')"
+ ('Fürst Pückler' 'leckerEis' 'cottbus.brandenburg' 80 'mein/Zuhause')
+ ('Jeannde.d''Arc' 'jaiunesécret' 'orleans' 8080 'une/deux/trois')
+ ('HaXor@roxor:fnac' 'my~Pa$§wert' 'cbase' 42 'do/not_try')
+ ) do: [:urlParts | |theUrl|
+ theUrl := ('http://{1}:{2}@{3}:{4}/{5}' format: {
+ (urlParts at: 1) encodeForHTTP. (urlParts at: 2) encodeForHTTP.
+ urlParts at: 3. urlParts at: 4. urlParts at: 5.
+ }) asUrl.
+ self
+ should: [theUrl schemeName = 'http'];
+ should: [theUrl username = (urlParts at: 1)];
+ should: [theUrl password = (urlParts at: 2)];
+ should: [theUrl authority = (urlParts at: 3)];
+ should: [theUrl port = (urlParts at: 4)];
+ should: [theUrl path first = ((urlParts at: 5) copyUpTo: $/)]].
+ !