[prev in list] [next in list] [prev in thread] [next in thread]
List: lon-capa-cvs
Subject: [LON-CAPA-cvs] cvs: modules /goltermann/internalTest/t UserRelated.pm
From: goltermann <goltermann () source ! lon-capa ! org>
Date: 2013-06-18 9:53:01
Message-ID: cvsgoltermann1371549181 () cvsserver
[Download RAW message or body]
goltermann Tue Jun 18 09:53:01 2013 EDT
Modified files:
/modules/goltermann/internalTest/t UserRelated.pm
Log:
added missing file
Index: modules/goltermann/internalTest/t/UserRelated.pm
diff -u /dev/null modules/goltermann/internalTest/t/UserRelated.pm:1.3
--- /dev/null Tue Jun 18 09:53:01 2013
+++ modules/goltermann/internalTest/t/UserRelated.pm Tue Jun 18 09:53:01 2013
@@ -0,0 +1,56 @@
+#! perl
+use strict;
+use warnings;
+package UserRelated;
+use Test::More;
+# use Smart::Comments;
+
+
+sub run(){
+ shift;
+ my %config = @_;
+
+ my $user = $config{'user'};
+ my $pw = $config{'pw'};
+ my $tmppw = 'tmppw12345'; # if something breaks while changing the pw \
(it shouldnt) you might need the temp password to set your old pw back manually + \
my $domain = $config{'domain'}; +
+
+ # Trying to write a testhash
+ is(&Apache::lonnet::appenv(%config), 'ok', 'writing %config in appenv');
+ is(&Apache::lonnet::delenv(%config), 'ok', 'deleting %config in appenv');
+ # i dont think this is a good 'clean' test
+ #
+
+ # trying to determine hostserver of user
+ my $homeserver = &Apache::lonnet::homeserver($user,$domain);
+ # my $homeserver = &Apache::lonnet::homeserver($user,'fhwfdev133'); # wrong \
data for testing + ok($homeserver ne 'no_host', 'host found '.$homeserver);
+ ok($homeserver ne 'no_account_on_host', 'account found');
+ #
+
+
+ # changes the password and see if it works
+ isnt(&Apache::lonnet::changepass($user, $domain, 'somebadpwwhichshouldnotwork', \
$homeserver), 'ok', 'trying wrong pw'); + \
is(&Apache::lonnet::changepass($user,$domain,$pw,'tmppw12345',$homeserver), 'ok', \
'change pw'); + isnt(&Apache::lonnet::authenticate($user,$tmppw,$domain), \
'no_host', 'authenticate with new pw'); + \
is(&Apache::lonnet::changepass($user,$domain,$tmppw,$pw,$homeserver), 'ok', 'changing \
to old pw'); +
+ # overrides old id without asking. thats ok when using a specially created \
testuser, but + # DONT USE WITH A PRODUCTIVE USER (if you dont know what you are \
doing) + my $uniqueId = localtime;
+ &Apache::lonnet::idput($domain, ($user => $uniqueId));
+ # checks if ID successfully set
+ my %idrget = &Apache::lonnet::idrget($domain, ($user));
+ ok($idrget{$user} eq $uniqueId, 'set new id');
+ #
+}
+
+END{
+ # TODO: test if repair function is needed
+ # if (errors){
+ # repair
+ # }
+}
+
+1;
_______________________________________________
LON-CAPA-cvs mailing list
LON-CAPA-cvs@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic