 create or replace function test_users_function_deletegroup_removes_data()
 returns setof text as $test$
 	declare
-		grpcur		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;
+		grpcur		refcursor;
 		agroup		text;
 	begin 
-		open grpcur;
+		select active_test_users() into grpcur;
 		fetch from grpcur into agroup;
 		perform users.delete_group('web-session-1', agroup);
 		return next is_empty(

create or replace function test_users_function_addgroup_inserts_data()
returns setof text as $test$
	declare 
		newgrpcur		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 is null;
		newgroup		text;
	begin 
		open newgrpcur;
		fetch from newgrpcur into newgroup;
		perform users.add_group('web-session-1', newgroup);
		return next results_eq( 

create or replace function test_users_function_add_user_password_length()
returns setof text as $test$
	declare
		newusercur		refcursor;
		user1			text;
	begin
		select new_test_users() into newusercur;
		fetch from newusercur into user1;
		return next throws_ok(
			$$select users.add_user('web-session-1', 
