adding all of botlist, initial add
[botlist.git] / openbotlist / tests / misc / ruby / TestUserAccess.rb
bloba5b03f0a9b7a33ffbb552c51cc21a88c199e43f8
1 ##\r
2 ## Berlin Brown\r
3 ## Ruby TestCase\r
4 \r
5 require File.join(File.dirname(__FILE__), '../../WEB-INF/lib/ruby/actions', 'core_users')\r
6 \r
7 require 'java'\r
8 \r
9 include_class 'org.spirit.bean.impl.BotListCoreUsers'\r
10 include_class "junit.framework.Test"\r
11 include_class "junit.framework.TestCase"\r
12 include_class "junit.framework.TestSuite"\r
13 include_class 'junit.textui.TestRunner'\r
15 include_class "org.spirit.test.JRubyTestCase"\r
17 include_class 'java.text.SimpleDateFormat'\r
18 include_class "java.util.Calendar"\r
20 class TestGroupLinks < JRubyTestCase\r
21   attr :ac\r
22   def initialize(context)\r
23     @ac = context\r
24   end\r
25   def test()\r
26     # Load the Controller for the Test\r
27     c = @ac.getBean("radController")\r
28     dao = c.coreUsersDao\r
29     core_users = CoreUsersManager::CoreUsers.new()\r
30     \r
31     user = BotListCoreUsers.new\r
32     user.userName = "billbobtest"\r
33     user.userPassword = "apr2010"\r
34     user.userEmail = "bob@bob.com"\r
35     dob = "01/01/1981"\r
36     \r
37     # Use java's Date format to format the input date\r
38     df = SimpleDateFormat.new("mm/dd/yyyy")\r
39     cal = Calendar.getInstance()\r
40     cal.time = df.parse(dob)\r
41     user.dateOfBirth = cal\r
42    \r
43     core_users.user = user\r
44     core_users.createUser(dao)\r
45   end\r
47   def to_s\r
48     "Current Test #{@ac}"\r
49   end\r
50 end\r
52 #---------------------------------------\r
53 t = TestGroupLinks.new($context)\r
54 begin\r
55   t.test()\r
56 rescue Exception => e\r
57   puts e.message\r
58   raise e.message\r
59 end\r
60 t\r
62 ## End of Script\r