 create or replace function test_users_function_login_username_case_insensitive()
 returns setof text as $test$
 	declare
-		activeusercur		cursor for select users.test_user.name
-							from users.test_user
-							left outer join users.user on 
-								(lower(users.test_user.name) = 
-								users.user.name)
-							where users.user.active = true;
+		activeusercur		refcursor;
 		activeuser		text;
 	begin 
-		open activeusercur;
+		select active_test_users() into activeusercur;
 		fetch from activeusercur into activeuser;
 		perform users.login('web-session-2', upper(activeuser),
 			'password');

	end; 
$test$ language plpgsql;

create or replace function test_users_schema()
returns setof text as $$
	begin 

create or replace function test_users_function_deletegroup_not_case_sensitive()
returns setof text as $test$
	declare
		grpcur		refcursor;
		agroup		text;
	begin 
		select active_test_users() into grpcur;
		fetch from grpcur into agroup;
		perform users.delete_group('web-session-1', upper(agroup));
		return next is_empty(
