--- /dev/null
+#
+# Input packet
+#
+Packet-Type = Access-Request
+User-Name = "groups_no_profiles_user"
+User-Password = "secret"
+NAS-IP-Address = "1.2.3.4"
+
+#
+# Expected answer
+#
+Packet-Type == Access-Accept
+Reply-Message == "Hello Groups User"
--- /dev/null
+#
+# Clear out old data
+#
+%sql("${delete_from_radcheck} 'groups_no_profiles_user'")
+%sql("${delete_from_radreply} 'groups_no_profiles_user'")
+
+%sql("DELETE FROM radusergroup WHERE username = 'groups_no_profiles_user'")
+
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'group_no_profile_a'")
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'group_no_profile_b'")
+
+%sql("DELETE FROM radgroupreply WHERE groupname = 'group_no_profile_a'")
+%sql("DELETE FROM radgroupreply WHERE groupname = 'group_no_profile_b'")
+
+#
+# Insert new test data
+#
+%sql("${insert_into_radcheck} ('group_profile_user_a', 'Password.Cleartext', ':=', 'invalidsecret')")
+
+%sql("INSERT INTO radusergroup (username, groupname, priority) VALUES ('groups_no_profiles_user', 'group_no_profile_a', 200)")
+
+%sql("INSERT INTO radgroupcheck (groupname, attribute, op, value) VALUES ('group_no_profile_a', 'Password.Cleartext', ':=', 'secret')")
+%sql("INSERT INTO radgroupcheck (groupname, attribute, op, value) VALUES ('group_no_profile_a', 'User-Profile', ':=', 'group_profile_b')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('group_no_profile_a', 'Reply-Message', ':=', 'Hello Groups User')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('group_no_profile_a', 'Fall-Through', ':=', 'no')")
+
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('group_no_profile_b', 'Reply-Message', ':=', 'Hello Profile User')")
+
+#
+# Run SQL
+#
+sql
+if (!updated) {
+ test_fail
+}
+
+if !(&control.Password.Cleartext == &User-Password) {
+ test_fail
+}
+
+if !(&reply.Reply-Message == "Hello Groups User") {
+ test_fail
+}
+
+test_pass
--- /dev/null
+#
+# Input packet
+#
+Packet-Type = Access-Request
+User-Name = "groups_profile_user_a"
+User-Password = "secret"
+NAS-IP-Address = "1.2.3.4"
+
+#
+# Expected answer
+#
+Packet-Type == Access-Accept
+Reply-Message == "Hello User"
--- /dev/null
+#
+# Clear out old data
+#
+%sql("${delete_from_radcheck} 'groups_profile_user_a'")
+%sql("${delete_from_radreply} 'groups_profile_user_a'")
+
+%sql("DELETE FROM radusergroup WHERE username = 'groups_profile_user_a'")
+
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'group_profile_a'")
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'group_profile_b'")
+
+%sql("DELETE FROM radgroupreply WHERE groupname = 'group_profile_a'")
+%sql("DELETE FROM radgroupreply WHERE groupname = 'group_profile_b'")
+
+#
+# Insert new test data
+#
+%sql("${insert_into_radcheck} ('group_profile_user_a', 'Password.Cleartext', ':=', 'invalidsecret')")
+
+%sql("INSERT INTO radusergroup (username, groupname, priority) VALUES ('groups_profile_user_a', 'group_profile_a', 100)")
+
+%sql("INSERT INTO radgroupcheck (groupname, attribute, op, value) VALUES ('group_profile_a', 'Password.Cleartext', ':=', 'secret')")
+%sql("INSERT INTO radgroupcheck (groupname, attribute, op, value) VALUES ('group_profile_a', 'User-Profile', ':=', 'group_profile_b')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('group_profile_a', 'Reply-Message', ':=', 'Hello User A')")
+
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('group_profile_b', 'Reply-Message', ':=', 'Hello User')")
+
+#
+# Run SQL
+#
+sql
+if (!updated) {
+ test_fail
+}
+
+if !(&control.Password.Cleartext == &User-Password) {
+ test_fail
+}
+
+if !(&reply.Reply-Message == "Hello User") {
+ test_fail
+}
+
+test_pass
--- /dev/null
+#
+# Input packet
+#
+Packet-Type = Access-Request
+User-Name = "profile_user_a"
+User-Password = "secret"
+NAS-IP-Address = "1.2.3.4"
+
+#
+# Expected answer
+#
+Packet-Type == Access-Accept
+Reply-Message == "Hello User"
--- /dev/null
+#
+# Clear out old data
+#
+%sql("${delete_from_radcheck} 'profile_user_a'")
+%sql("${delete_from_radreply} 'profile_user_a'")
+
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'profile_a'")
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'profile_b'")
+%sql("DELETE FROM radgroupcheck WHERE groupname = 'profile_c'")
+
+%sql("DELETE FROM radgroupreply WHERE groupname = 'profile_a'")
+%sql("DELETE FROM radgroupreply WHERE groupname = 'profile_b'")
+%sql("DELETE FROM radgroupreply WHERE groupname = 'profile_c'")
+
+#
+# Insert new test data
+#
+%sql("${insert_into_radcheck} ('profile_user_a', 'Password.Cleartext', ':=', 'invalidsecret')")
+%sql("${insert_into_radcheck} ('profile_user_a', 'User-Profile', ':=', 'profile_a')")
+%sql("${insert_into_radcheck} ('profile_user_a', 'User-Profile', '+=', 'profile_b')")
+
+%sql("INSERT INTO radgroupcheck (groupname, attribute, op, value) VALUES ('profile_a', 'Password.Cleartext', ':=', 'secret')")
+
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('profile_a', 'Reply-Message', ':=', 'Hello User A')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('profile_a', 'Fall-Through', ':=', 'yes')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('profile_b', 'Reply-Message', ':=', 'Hello User')")
+%sql("INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('profile_c', 'Reply-Message', ':=', 'Hello User B')")
+
+#
+# Run SQL
+#
+sql
+if (!updated) {
+ test_fail
+}
+
+if !(&control.Password.Cleartext == &User-Password) {
+ test_fail
+}
+
+if !(&reply.Reply-Message == "Hello User") {
+ test_fail
+}
+
+test_pass
--- /dev/null
+../sql/groups_no_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_no_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/groups_no_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_no_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/groups_no_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_no_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/groups_then_profiles.unlang
\ No newline at end of file
--- /dev/null
+../sql/profiles.attrs
\ No newline at end of file
--- /dev/null
+../sql/profiles.unlang
\ No newline at end of file