@@ -29,7 +29,7 @@ public function testChangePasswordChangesDefaultApiKey()
29
29
{
30
30
$ usersFile = $ this ->loadData ('User ' , 'default ' );
31
31
$ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
32
-
32
+
33
33
$ modelLoad = new MIDAS_ModelLoader ();
34
34
$ userApiModel = $ modelLoad ->loadModel ('Userapi ' , 'api ' );
35
35
$ userApiModel ->createDefaultApiKey ($ userDao );
@@ -44,7 +44,7 @@ public function testChangePasswordChangesDefaultApiKey()
44
44
45
45
$ page = $ this ->webroot .'user/settings ' ;
46
46
$ this ->dispatchUrI ($ page , $ userDao );
47
-
47
+
48
48
$ postKey = $ userApiModel ->getByAppAndUser ('Default ' , $ userDao )->getApikey ();
49
49
$ this ->assertNotEquals ($ preKey , $ postKey );
50
50
$ passwordPrefix = Zend_Registry::get ('configGlobal ' )->password ->prefix ;
@@ -54,5 +54,22 @@ public function testChangePasswordChangesDefaultApiKey()
54
54
/** Make sure adding a new user adds a default api key */
55
55
public function testNewUserGetsDefaultApiKey ()
56
56
{
57
+ // Register a new user
58
+ $ this ->params ['email ' ] = 'some.user@server.com ' ;
59
+ $ this ->params ['password1 ' ] = 'midas ' ;
60
+ $ this ->params ['password2 ' ] = 'midas ' ;
61
+ $ this ->params ['firstname ' ] = 'some ' ;
62
+ $ this ->params ['lastname ' ] = 'user ' ;
63
+ $ this ->request ->setMethod ('POST ' );
64
+
65
+ $ page = $ this ->webroot .'user/register ' ;
66
+ $ this ->dispatchUrI ($ page );
67
+
68
+ // Check that their default api key was created
69
+ $ modelLoad = new MIDAS_ModelLoader ();
70
+ $ userApiModel = $ modelLoad ->loadModel ('Userapi ' , 'api ' );
71
+ $ key = $ userApiModel ->getByAppAndEmail ('Default ' , 'some.user@server.com ' )->getApikey ();
72
+ $ passwordPrefix = Zend_Registry::get ('configGlobal ' )->password ->prefix ;
73
+ $ this ->assertEquals ($ key , md5 ('some.user@server.com ' .md5 ($ passwordPrefix .'midas ' ).'Default ' ));
57
74
}
58
75
}
0 commit comments