 create or replace function test_users_function_login_changes_session_owner()
 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', 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_deleteuser_removes_data()
returns setof text as $test$
	declare 
		activeusercur		refcursor;
		activeuser		text;
	begin 
		select active_test_users() into activeusercur;
		fetch from activeusercur into activeuser;
		perform users.delete_user('web-session-1', activeuser);
		return next is_empty(
