Updated Database Query error handling.
Add support for user profiles. Updated test case.
This commit is contained in:
@@ -5,7 +5,7 @@ note
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
testing:"execution/serial"
|
||||
|
||||
class
|
||||
USER_TEST_SET
|
||||
@@ -36,6 +36,7 @@ feature {NONE} -- Events
|
||||
on_clean
|
||||
-- <Precursor>
|
||||
do
|
||||
-- (create {CLEAN_DB}).clean_db(connection)
|
||||
end
|
||||
|
||||
feature -- Test routines
|
||||
@@ -51,9 +52,9 @@ feature -- Test routines
|
||||
test_user_not_exist
|
||||
-- Uset test does not exist.
|
||||
do
|
||||
assert ("Void", user_provider.user_by_email ("test@admin.com") = Void)
|
||||
assert ("Void", user_provider.user(2) = Void )
|
||||
assert ("Void", user_provider.user_by_name ("test") = Void)
|
||||
assert ("User by email: Void", user_provider.user_by_email ("test1@test.com") = Void)
|
||||
assert ("User by id: Void", user_provider.user(5) = Void )
|
||||
assert ("User by name: Void", user_provider.user_by_name ("test1") = Void)
|
||||
end
|
||||
|
||||
test_new_user
|
||||
@@ -74,6 +75,34 @@ feature -- Test routines
|
||||
assert ("Not empty roles for given user", not user_provider.user_roles (1).after)
|
||||
end
|
||||
|
||||
test_new_user_without_profile
|
||||
do
|
||||
user_provider.new_user ("test", "test","test@admin.com")
|
||||
assert ("Empty", user_provider.user_profile (1).new_cursor.after)
|
||||
end
|
||||
|
||||
test_new_user_with_profile
|
||||
local
|
||||
l_profile: CMS_USER_PROFILE
|
||||
l_db_profile: CMS_USER_PROFILE
|
||||
do
|
||||
user_provider.new_user ("test", "test","test@admin.com")
|
||||
if attached {CMS_USER} user_provider.user_by_name ("test") as l_user then
|
||||
assert ("Empty", user_provider.user_profile (l_user.id).new_cursor.after)
|
||||
create l_profile.make
|
||||
l_profile.force ("Eiffel", "language")
|
||||
l_profile.force ("Argentina", "country")
|
||||
l_profile.force ("GMT-3", "time zone")
|
||||
user_provider.save_profile (l_user.id, l_profile)
|
||||
l_db_profile := user_provider.user_profile (l_user.id)
|
||||
assert ("Not Empty", not l_db_profile.new_cursor.after)
|
||||
|
||||
assert ("Expected language Eiffel", attached l_db_profile.item ("language") as l_language and then l_language ~ "Eiffel")
|
||||
assert ("Expected time zone GMT-3", attached l_db_profile.item ("time zone") as l_language and then l_language ~ "GMT-3")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
user_provider: USER_DATA_PROVIDER
|
||||
|
||||
Reference in New Issue
Block a user