Description:
more login test add grader configuration to fixture add minitest reporter
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r627:f6a768e3c391 - - 10 files changed: 400 inserted, 155 deleted

@@ -0,0 +1,41
1 + # Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
2 + #
3 + # Optimized version which uses to_yaml for content creation and checks
4 + # that models are ActiveRecord::Base models before trying to fetch
5 + # them from database.
6 + namespace :db do
7 + namespace :fixtures do
8 + desc 'Dumps all models into fixtures.'
9 + task :dump => :environment do
10 + puts "rails root = #{Rails.root}"
11 + models = Dir.glob(Rails.root.to_s + '/app/models/**.rb').map do |s|
12 + Pathname.new(s).basename.to_s.gsub(/\.rb$/,'').camelize
13 + end
14 +
15 + puts "Found models: " + models.join(', ')
16 +
17 + models.each do |m|
18 + model = m.constantize
19 + next unless model.ancestors.include?(ActiveRecord::Base)
20 +
21 + puts "Dumping model: " + m
22 + entries = model.all.order(id: :asc)
23 +
24 + increment = 1
25 +
26 + model_file = Rails.root.to_s + '/test/fixtures2/' + m.underscore.pluralize + '.yml'
27 + File.open(model_file, 'w') do |f|
28 + entries.each do |a|
29 + attrs = a.attributes
30 + attrs.delete_if{|k,v| v.blank?}
31 +
32 + output = {m + '_' + increment.to_s => attrs}
33 + f << output.to_yaml.gsub(/^--- \n/,'') + "\n"
34 +
35 + increment += 1
36 + end
37 + end
38 + end
39 + end
40 + end
41 + end
@@ -0,0 +1,144
1 + GraderConfiguration_1:
2 + key: system.single_user_mode
3 + value_type: boolean
4 + value: 'false'
5 + description: Only admins can log in to the system when running under single user mode.
6 +
7 + GraderConfiguration_2:
8 + key: ui.front.title
9 + value_type: string
10 + value: Grader
11 +
12 + GraderConfiguration_3:
13 + key: ui.front.welcome_message
14 + value_type: string
15 + value: Welcome!
16 +
17 + GraderConfiguration_4:
18 + key: ui.show_score
19 + value_type: boolean
20 + value: 'true'
21 +
22 + GraderConfiguration_5:
23 + key: contest.time_limit
24 + value_type: string
25 + value: unlimited
26 + description: Time limit in format hh:mm, or "unlimited" for contests with no time
27 + limits. This config is CACHED. Restart the server before the change can take
28 + effect.
29 +
30 + GraderConfiguration_6:
31 + key: system.mode
32 + value_type: string
33 + value: standard
34 + description: Current modes are "standard", "contest", "indv-contest", and "analysis".
35 +
36 +
37 + GraderConfiguration_7:
38 + key: contest.name
39 + value_type: string
40 + value: Grader
41 + description: This name will be shown on the user header bar.
42 +
43 +
44 + GraderConfiguration_8:
45 + key: contest.multisites
46 + value_type: boolean
47 + value: 'false'
48 + description: If the server is in contest mode and this option is true, on the log
49 + in of the admin a menu for site selections is shown.
50 +
51 +
52 + GraderConfiguration_9:
53 + key: right.user_hall_of_fame
54 + value_type: boolean
55 + value: 'false'
56 + description: If true, any user can access hall of fame page.
57 +
58 +
59 + GraderConfiguration_10:
60 + key: right.multiple_ip_login
61 + value_type: boolean
62 + value: 'true'
63 + description: When change from true to false, a user can login from the first IP
64 + they logged into afterward.
65 +
66 +
67 + GraderConfiguration_11:
68 + key: right.user_view_submission
69 + value_type: boolean
70 + value: 'false'
71 + description: If true, any user can view submissions of every one.
72 +
73 +
74 + GraderConfiguration_12:
75 + key: right.bypass_agreement
76 + value_type: boolean
77 + value: 'true'
78 + description: When false, a user must accept usage agreement before login
79 +
80 +
81 + GraderConfiguration_13:
82 + key: right.heartbeat_response
83 + value_type: string
84 + value: OK
85 + description: Heart beat response text
86 +
87 +
88 + GraderConfiguration_14:
89 + key: right.view_testcase
90 + value_type: boolean
91 + value: 'false'
92 + description: When true, any user can view/download test data
93 +
94 +
95 + GraderConfiguration_15:
96 + key: system.online_registration.smtp
97 + value_type: string
98 + value: smtp.somehost.com
99 +
100 +
101 + GraderConfiguration_16:
102 + key: system.online_registration.from
103 + value_type: string
104 + value: your.email@address
105 +
106 +
107 + GraderConfiguration_17:
108 + key: system.admin_email
109 + value_type: string
110 + value: admin@admin.email
111 +
112 +
113 + GraderConfiguration_18:
114 + key: system.user_setting_enabled
115 + value_type: boolean
116 + value: 'true'
117 + description: If this option is true, users can change their settings
118 +
119 +
120 + GraderConfiguration_19:
121 + key: contest.test_request.early_timeout
122 + value_type: boolean
123 + value: 'false'
124 +
125 +
126 + GraderConfiguration_20:
127 + key: system.multicontests
128 + value_type: boolean
129 + value: 'false'
130 +
131 +
132 + GraderConfiguration_21:
133 + key: contest.confirm_indv_contest_start
134 + value_type: boolean
135 + value: 'false'
136 +
137 +
138 + GraderConfiguration_22:
139 + key: contest.default_contest_name
140 + value_type: string
141 + value: none
142 + description: New user will be assigned to this contest automatically, if it exists. Set
143 + to 'none' if there is no default contest.
144 +
@@ -1,15 +1,20
1 source 'https://rubygems.org'
1 source 'https://rubygems.org'
2
2
3 + #rails
3 gem 'rails', '~>4.2.0'
4 gem 'rails', '~>4.2.0'
4 gem 'activerecord-session_store'
5 gem 'activerecord-session_store'
5
6
6 - gem 'select2-rails'
7
7
8 # Bundle edge Rails instead:
8 # Bundle edge Rails instead:
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
10
10
11 + #---------------- database ---------------------
12 + #the database
11 gem 'mysql2'
13 gem 'mysql2'
14 + #for testing
12 gem 'sqlite3'
15 gem 'sqlite3'
16 + #for dumping database into yaml
17 + gem 'yaml_db'
13
18
14 # Gems used only for assets and not required
19 # Gems used only for assets and not required
15 # in production environments by default.
20 # in production environments by default.
@@ -21,7 +26,8
21
26
22 gem 'uglifier'
27 gem 'uglifier'
23
28
24 -
29 + gem 'haml'
30 + gem 'haml-rails'
25 # gem 'prototype-rails'
31 # gem 'prototype-rails'
26
32
27 # To use ActiveModel has_secure_password
33 # To use ActiveModel has_secure_password
@@ -63,16 +69,20
63 gem 'momentjs-rails'
69 gem 'momentjs-rails'
64 gem 'rails_bootstrap_sortable'
70 gem 'rails_bootstrap_sortable'
65
71
72 + #----------- user interface -----------------
73 + #select 2
74 + gem 'select2-rails'
66 #ace editor
75 #ace editor
67 gem 'ace-rails-ap'
76 gem 'ace-rails-ap'
77 + #paginator
78 + gem 'will_paginate', '~> 3.0.7'
68
79
69 - gem 'haml'
70 - gem 'haml-rails'
71 gem 'mail'
80 gem 'mail'
72 gem 'rdiscount'
81 gem 'rdiscount'
73 - #gem 'test-unit'
74 - gem 'will_paginate', '~> 3.0.7'
75 gem 'dynamic_form'
82 gem 'dynamic_form'
76 gem 'in_place_editing'
83 gem 'in_place_editing'
77 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
84 gem 'verification', :git => 'https://github.com/sikachu/verification.git'
78
85
86 +
87 + #---------------- testiing -----------------------
88 + gem 'minitest-reporters'
@@ -51,6 +51,7
51 minitest (~> 5.1)
51 minitest (~> 5.1)
52 thread_safe (~> 0.3, >= 0.3.4)
52 thread_safe (~> 0.3, >= 0.3.4)
53 tzinfo (~> 1.1)
53 tzinfo (~> 1.1)
54 + ansi (1.5.0)
54 arel (6.0.4)
55 arel (6.0.4)
55 autoprefixer-rails (6.6.0)
56 autoprefixer-rails (6.6.0)
56 execjs
57 execjs
@@ -111,6 +112,11
111 mime-types-data (3.2016.0521)
112 mime-types-data (3.2016.0521)
112 mini_portile2 (2.1.0)
113 mini_portile2 (2.1.0)
113 minitest (5.10.1)
114 minitest (5.10.1)
115 + minitest-reporters (1.1.13)
116 + ansi
117 + builder
118 + minitest (>= 5.0)
119 + ruby-progressbar
114 momentjs-rails (2.15.1)
120 momentjs-rails (2.15.1)
115 railties (>= 3.1)
121 railties (>= 3.1)
116 multi_json (1.12.1)
122 multi_json (1.12.1)
@@ -149,6 +155,7
149 rake (12.0.0)
155 rake (12.0.0)
150 rdiscount (2.2.0.1)
156 rdiscount (2.2.0.1)
151 rouge (2.0.7)
157 rouge (2.0.7)
158 + ruby-progressbar (1.8.1)
152 ruby_parser (3.8.3)
159 ruby_parser (3.8.3)
153 sexp_processor (~> 4.1)
160 sexp_processor (~> 4.1)
154 sass (3.4.23)
161 sass (3.4.23)
@@ -177,6 +184,9
177 uglifier (3.0.4)
184 uglifier (3.0.4)
178 execjs (>= 0.3.0, < 3)
185 execjs (>= 0.3.0, < 3)
179 will_paginate (3.0.12)
186 will_paginate (3.0.12)
187 + yaml_db (0.4.2)
188 + rails (>= 3.0, < 5.1)
189 + rake (>= 0.8.7)
180
190
181 PLATFORMS
191 PLATFORMS
182 ruby
192 ruby
@@ -200,6 +210,7
200 jquery-timepicker-addon-rails
210 jquery-timepicker-addon-rails
201 jquery-ui-rails
211 jquery-ui-rails
202 mail
212 mail
213 + minitest-reporters
203 momentjs-rails
214 momentjs-rails
204 mysql2
215 mysql2
205 rails (~> 4.2.0)
216 rails (~> 4.2.0)
@@ -212,6 +223,7
212 uglifier
223 uglifier
213 verification!
224 verification!
214 will_paginate (~> 3.0.7)
225 will_paginate (~> 3.0.7)
226 + yaml_db
215
227
216 BUNDLED WITH
228 BUNDLED WITH
217 1.13.6
229 1.13.6
@@ -1,7 +1,7
1 class ApplicationController < ActionController::Base
1 class ApplicationController < ActionController::Base
2 protect_from_forgery
2 protect_from_forgery
3
3
4 - before_filter :current_user
4 + before_filter :current_user
5
5
6 SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode'
6 SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode'
7 MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login'
7 MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login'
@@ -11,7 +11,7
11 CONTEST_TIME_LIMIT_KEY = 'contest.time_limit'
11 CONTEST_TIME_LIMIT_KEY = 'contest.time_limit'
12 MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login'
12 MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login'
13 VIEW_TESTCASE = 'right.view_testcase'
13 VIEW_TESTCASE = 'right.view_testcase'
14 - SINGLE_USER_KEY = 'system.single_user'
14 + SINGLE_USER_KEY = 'system.single_user_mode'
15
15
16 cattr_accessor :config_cache
16 cattr_accessor :config_cache
17 cattr_accessor :task_grading_info_cache
17 cattr_accessor :task_grading_info_cache
@@ -14,200 +14,200
14 ActiveRecord::Schema.define(version: 20161031063337) do
14 ActiveRecord::Schema.define(version: 20161031063337) do
15
15
16 create_table "announcements", force: :cascade do |t|
16 create_table "announcements", force: :cascade do |t|
17 - t.string "author"
17 + t.string "author", limit: 255
18 - t.text "body"
18 + t.text "body", limit: 65535
19 t.boolean "published"
19 t.boolean "published"
20 - t.datetime "created_at", null: false
20 + t.datetime "created_at", null: false
21 - t.datetime "updated_at", null: false
21 + t.datetime "updated_at", null: false
22 - t.boolean "frontpage", default: false
22 + t.boolean "frontpage", default: false
23 - t.boolean "contest_only", default: false
23 + t.boolean "contest_only", default: false
24 - t.string "title"
24 + t.string "title", limit: 255
25 - t.string "notes"
25 + t.string "notes", limit: 255
26 end
26 end
27
27
28 create_table "contests", force: :cascade do |t|
28 create_table "contests", force: :cascade do |t|
29 - t.string "title"
29 + t.string "title", limit: 255
30 t.boolean "enabled"
30 t.boolean "enabled"
31 - t.datetime "created_at", null: false
31 + t.datetime "created_at", null: false
32 - t.datetime "updated_at", null: false
32 + t.datetime "updated_at", null: false
33 - t.string "name"
33 + t.string "name", limit: 255
34 end
34 end
35
35
36 create_table "contests_problems", id: false, force: :cascade do |t|
36 create_table "contests_problems", id: false, force: :cascade do |t|
37 - t.integer "contest_id"
37 + t.integer "contest_id", limit: 4
38 - t.integer "problem_id"
38 + t.integer "problem_id", limit: 4
39 end
39 end
40
40
41 create_table "contests_users", id: false, force: :cascade do |t|
41 create_table "contests_users", id: false, force: :cascade do |t|
42 - t.integer "contest_id"
42 + t.integer "contest_id", limit: 4
43 - t.integer "user_id"
43 + t.integer "user_id", limit: 4
44 end
44 end
45
45
46 create_table "countries", force: :cascade do |t|
46 create_table "countries", force: :cascade do |t|
47 - t.string "name"
47 + t.string "name", limit: 255
48 - t.datetime "created_at", null: false
48 + t.datetime "created_at", null: false
49 - t.datetime "updated_at", null: false
49 + t.datetime "updated_at", null: false
50 end
50 end
51
51
52 create_table "descriptions", force: :cascade do |t|
52 create_table "descriptions", force: :cascade do |t|
53 - t.text "body"
53 + t.text "body", limit: 65535
54 t.boolean "markdowned"
54 t.boolean "markdowned"
55 - t.datetime "created_at", null: false
55 + t.datetime "created_at", null: false
56 - t.datetime "updated_at", null: false
56 + t.datetime "updated_at", null: false
57 end
57 end
58
58
59 create_table "grader_configurations", force: :cascade do |t|
59 create_table "grader_configurations", force: :cascade do |t|
60 - t.string "key"
60 + t.string "key", limit: 255
61 - t.string "value_type"
61 + t.string "value_type", limit: 255
62 - t.string "value"
62 + t.string "value", limit: 255
63 - t.datetime "created_at", null: false
63 + t.datetime "created_at", null: false
64 - t.datetime "updated_at", null: false
64 + t.datetime "updated_at", null: false
65 - t.text "description"
65 + t.text "description", limit: 65535
66 end
66 end
67
67
68 create_table "grader_processes", force: :cascade do |t|
68 create_table "grader_processes", force: :cascade do |t|
69 - t.string "host"
69 + t.string "host", limit: 255
70 - t.integer "pid"
70 + t.integer "pid", limit: 4
71 - t.string "mode"
71 + t.string "mode", limit: 255
72 t.boolean "active"
72 t.boolean "active"
73 - t.datetime "created_at", null: false
73 + t.datetime "created_at", null: false
74 - t.datetime "updated_at", null: false
74 + t.datetime "updated_at", null: false
75 - t.integer "task_id"
75 + t.integer "task_id", limit: 4
76 - t.string "task_type"
76 + t.string "task_type", limit: 255
77 t.boolean "terminated"
77 t.boolean "terminated"
78 end
78 end
79
79
80 - add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid"
80 + add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree
81
81
82 create_table "heart_beats", force: :cascade do |t|
82 create_table "heart_beats", force: :cascade do |t|
83 - t.integer "user_id"
83 + t.integer "user_id", limit: 4
84 - t.string "ip_address"
84 + t.string "ip_address", limit: 255
85 - t.datetime "created_at", null: false
85 + t.datetime "created_at", null: false
86 - t.datetime "updated_at", null: false
86 + t.datetime "updated_at", null: false
87 - t.string "status"
87 + t.string "status", limit: 255
88 end
88 end
89
89
90 - add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at"
90 + add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
91
91
92 create_table "languages", force: :cascade do |t|
92 create_table "languages", force: :cascade do |t|
93 t.string "name", limit: 10
93 t.string "name", limit: 10
94 - t.string "pretty_name"
94 + t.string "pretty_name", limit: 255
95 t.string "ext", limit: 10
95 t.string "ext", limit: 10
96 - t.string "common_ext"
96 + t.string "common_ext", limit: 255
97 end
97 end
98
98
99 create_table "logins", force: :cascade do |t|
99 create_table "logins", force: :cascade do |t|
100 - t.integer "user_id"
100 + t.integer "user_id", limit: 4
101 - t.string "ip_address"
101 + t.string "ip_address", limit: 255
102 - t.datetime "created_at", null: false
102 + t.datetime "created_at", null: false
103 - t.datetime "updated_at", null: false
103 + t.datetime "updated_at", null: false
104 end
104 end
105
105
106 create_table "messages", force: :cascade do |t|
106 create_table "messages", force: :cascade do |t|
107 - t.integer "sender_id"
107 + t.integer "sender_id", limit: 4
108 - t.integer "receiver_id"
108 + t.integer "receiver_id", limit: 4
109 - t.integer "replying_message_id"
109 + t.integer "replying_message_id", limit: 4
110 - t.text "body"
110 + t.text "body", limit: 65535
111 t.boolean "replied"
111 t.boolean "replied"
112 - t.datetime "created_at", null: false
112 + t.datetime "created_at", null: false
113 - t.datetime "updated_at", null: false
113 + t.datetime "updated_at", null: false
114 end
114 end
115
115
116 create_table "problems", force: :cascade do |t|
116 create_table "problems", force: :cascade do |t|
117 t.string "name", limit: 30
117 t.string "name", limit: 30
118 - t.string "full_name"
118 + t.string "full_name", limit: 255
119 - t.integer "full_score"
119 + t.integer "full_score", limit: 4
120 t.date "date_added"
120 t.date "date_added"
121 t.boolean "available"
121 t.boolean "available"
122 - t.string "url"
122 + t.string "url", limit: 255
123 - t.integer "description_id"
123 + t.integer "description_id", limit: 4
124 t.boolean "test_allowed"
124 t.boolean "test_allowed"
125 t.boolean "output_only"
125 t.boolean "output_only"
126 - t.string "description_filename"
126 + t.string "description_filename", limit: 255
127 end
127 end
128
128
129 create_table "rights", force: :cascade do |t|
129 create_table "rights", force: :cascade do |t|
130 - t.string "name"
130 + t.string "name", limit: 255
131 - t.string "controller"
131 + t.string "controller", limit: 255
132 - t.string "action"
132 + t.string "action", limit: 255
133 end
133 end
134
134
135 create_table "rights_roles", id: false, force: :cascade do |t|
135 create_table "rights_roles", id: false, force: :cascade do |t|
136 - t.integer "right_id"
136 + t.integer "right_id", limit: 4
137 - t.integer "role_id"
137 + t.integer "role_id", limit: 4
138 end
138 end
139
139
140 - add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id"
140 + add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
141
141
142 create_table "roles", force: :cascade do |t|
142 create_table "roles", force: :cascade do |t|
143 - t.string "name"
143 + t.string "name", limit: 255
144 end
144 end
145
145
146 create_table "roles_users", id: false, force: :cascade do |t|
146 create_table "roles_users", id: false, force: :cascade do |t|
147 - t.integer "role_id"
147 + t.integer "role_id", limit: 4
148 - t.integer "user_id"
148 + t.integer "user_id", limit: 4
149 end
149 end
150
150
151 - add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id"
151 + add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree
152
152
153 create_table "sessions", force: :cascade do |t|
153 create_table "sessions", force: :cascade do |t|
154 - t.string "session_id"
154 + t.string "session_id", limit: 255
155 - t.text "data"
155 + t.text "data", limit: 65535
156 t.datetime "updated_at"
156 t.datetime "updated_at"
157 end
157 end
158
158
159 - add_index "sessions", ["session_id"], name: "index_sessions_on_session_id"
159 + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
160 - add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at"
160 + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
161
161
162 create_table "sites", force: :cascade do |t|
162 create_table "sites", force: :cascade do |t|
163 - t.string "name"
163 + t.string "name", limit: 255
164 t.boolean "started"
164 t.boolean "started"
165 t.datetime "start_time"
165 t.datetime "start_time"
166 - t.datetime "created_at", null: false
166 + t.datetime "created_at", null: false
167 - t.datetime "updated_at", null: false
167 + t.datetime "updated_at", null: false
168 - t.integer "country_id"
168 + t.integer "country_id", limit: 4
169 - t.string "password"
169 + t.string "password", limit: 255
170 end
170 end
171
171
172 create_table "submission_view_logs", force: :cascade do |t|
172 create_table "submission_view_logs", force: :cascade do |t|
173 - t.integer "user_id"
173 + t.integer "user_id", limit: 4
174 - t.integer "submission_id"
174 + t.integer "submission_id", limit: 4
175 - t.datetime "created_at", null: false
175 + t.datetime "created_at", null: false
176 - t.datetime "updated_at", null: false
176 + t.datetime "updated_at", null: false
177 end
177 end
178
178
179 create_table "submissions", force: :cascade do |t|
179 create_table "submissions", force: :cascade do |t|
180 - t.integer "user_id"
180 + t.integer "user_id", limit: 4
181 - t.integer "problem_id"
181 + t.integer "problem_id", limit: 4
182 - t.integer "language_id"
182 + t.integer "language_id", limit: 4
183 - t.text "source"
183 + t.text "source", limit: 65535
184 - t.binary "binary"
184 + t.binary "binary", limit: 65535
185 t.datetime "submitted_at"
185 t.datetime "submitted_at"
186 t.datetime "compiled_at"
186 t.datetime "compiled_at"
187 - t.text "compiler_message"
187 + t.text "compiler_message", limit: 65535
188 t.datetime "graded_at"
188 t.datetime "graded_at"
189 - t.integer "points"
189 + t.integer "points", limit: 4
190 - t.text "grader_comment"
190 + t.text "grader_comment", limit: 65535
191 - t.integer "number"
191 + t.integer "number", limit: 4
192 - t.string "source_filename"
192 + t.string "source_filename", limit: 255
193 - t.float "max_runtime"
193 + t.float "max_runtime", limit: 24
194 - t.integer "peak_memory"
194 + t.integer "peak_memory", limit: 4
195 - t.integer "effective_code_length"
195 + t.integer "effective_code_length", limit: 4
196 - t.string "ip_address"
196 + t.string "ip_address", limit: 255
197 end
197 end
198
198
199 - add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true
199 + add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
200 - add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id"
200 + add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
201
201
202 create_table "tasks", force: :cascade do |t|
202 create_table "tasks", force: :cascade do |t|
203 - t.integer "submission_id"
203 + t.integer "submission_id", limit: 4
204 t.datetime "created_at"
204 t.datetime "created_at"
205 - t.integer "status"
205 + t.integer "status", limit: 4
206 t.datetime "updated_at"
206 t.datetime "updated_at"
207 end
207 end
208
208
209 create_table "test_pairs", force: :cascade do |t|
209 create_table "test_pairs", force: :cascade do |t|
210 - t.integer "problem_id"
210 + t.integer "problem_id", limit: 4
211 t.text "input", limit: 16777215
211 t.text "input", limit: 16777215
212 t.text "solution", limit: 16777215
212 t.text "solution", limit: 16777215
213 t.datetime "created_at", null: false
213 t.datetime "created_at", null: false
@@ -215,66 +215,66
215 end
215 end
216
216
217 create_table "test_requests", force: :cascade do |t|
217 create_table "test_requests", force: :cascade do |t|
218 - t.integer "user_id"
218 + t.integer "user_id", limit: 4
219 - t.integer "problem_id"
219 + t.integer "problem_id", limit: 4
220 - t.integer "submission_id"
220 + t.integer "submission_id", limit: 4
221 - t.string "input_file_name"
221 + t.string "input_file_name", limit: 255
222 - t.string "output_file_name"
222 + t.string "output_file_name", limit: 255
223 - t.string "running_stat"
223 + t.string "running_stat", limit: 255
224 - t.integer "status"
224 + t.integer "status", limit: 4
225 - t.datetime "updated_at", null: false
225 + t.datetime "updated_at", null: false
226 t.datetime "submitted_at"
226 t.datetime "submitted_at"
227 t.datetime "compiled_at"
227 t.datetime "compiled_at"
228 - t.text "compiler_message"
228 + t.text "compiler_message", limit: 65535
229 t.datetime "graded_at"
229 t.datetime "graded_at"
230 - t.string "grader_comment"
230 + t.string "grader_comment", limit: 255
231 - t.datetime "created_at", null: false
231 + t.datetime "created_at", null: false
232 - t.float "running_time"
232 + t.float "running_time", limit: 24
233 - t.string "exit_status"
233 + t.string "exit_status", limit: 255
234 - t.integer "memory_usage"
234 + t.integer "memory_usage", limit: 4
235 end
235 end
236
236
237 - add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
237 + add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
238
238
239 create_table "testcases", force: :cascade do |t|
239 create_table "testcases", force: :cascade do |t|
240 - t.integer "problem_id"
240 + t.integer "problem_id", limit: 4
241 - t.integer "num"
241 + t.integer "num", limit: 4
242 - t.integer "group"
242 + t.integer "group", limit: 4
243 - t.integer "score"
243 + t.integer "score", limit: 4
244 - t.text "input"
244 + t.text "input", limit: 65535
245 - t.text "sol"
245 + t.text "sol", limit: 65535
246 - t.datetime "created_at", null: false
246 + t.datetime "created_at"
247 - t.datetime "updated_at", null: false
247 + t.datetime "updated_at"
248 end
248 end
249
249
250 - add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id"
250 + add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
251
251
252 create_table "user_contest_stats", force: :cascade do |t|
252 create_table "user_contest_stats", force: :cascade do |t|
253 - t.integer "user_id"
253 + t.integer "user_id", limit: 4
254 t.datetime "started_at"
254 t.datetime "started_at"
255 - t.datetime "created_at", null: false
255 + t.datetime "created_at", null: false
256 - t.datetime "updated_at", null: false
256 + t.datetime "updated_at", null: false
257 t.boolean "forced_logout"
257 t.boolean "forced_logout"
258 end
258 end
259
259
260 create_table "users", force: :cascade do |t|
260 create_table "users", force: :cascade do |t|
261 t.string "login", limit: 50
261 t.string "login", limit: 50
262 - t.string "full_name"
262 + t.string "full_name", limit: 255
263 - t.string "hashed_password"
263 + t.string "hashed_password", limit: 255
264 t.string "salt", limit: 5
264 t.string "salt", limit: 5
265 - t.string "alias"
265 + t.string "alias", limit: 255
266 - t.string "email"
266 + t.string "email", limit: 255
267 - t.integer "site_id"
267 + t.integer "site_id", limit: 4
268 - t.integer "country_id"
268 + t.integer "country_id", limit: 4
269 - t.boolean "activated", default: false
269 + t.boolean "activated", default: false
270 t.datetime "created_at"
270 t.datetime "created_at"
271 t.datetime "updated_at"
271 t.datetime "updated_at"
272 - t.boolean "enabled", default: true
272 + t.boolean "enabled", default: true
273 - t.string "remark"
273 + t.string "remark", limit: 255
274 - t.string "last_ip"
274 + t.string "last_ip", limit: 255
275 - t.string "section"
275 + t.string "section", limit: 255
276 end
276 end
277
277
278 - add_index "users", ["login"], name: "index_users_on_login", unique: true
278 + add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
279
279
280 end
280 end
@@ -1,5 +1,36
1 - # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
1 + Language_1:
2 - one:
2 + name: c
3 - id: 1
3 + pretty_name: C
4 - two:
4 + ext: c
5 - id: 2
5 + common_ext: c
6 +
7 + Language_2:
8 + name: cpp
9 + pretty_name: C++
10 + ext: cpp
11 + common_ext: cpp,cc
12 +
13 + Language_3:
14 + name: pas
15 + pretty_name: Pascal
16 + ext: pas
17 + common_ext: pas
18 +
19 + Language_4:
20 + name: ruby
21 + pretty_name: Ruby
22 + ext: rb
23 + common_ext: rb
24 +
25 + Language_5:
26 + name: python
27 + pretty_name: Python
28 + ext: py
29 + common_ext: py
30 +
31 + Language_6:
32 + name: java
33 + pretty_name: Java
34 + ext: java
35 + common_ext: java
36 +
@@ -20,15 +20,18
20 end
20 end
21
21
22 test "normal user login in single_user mode" do
22 test "normal user login in single_user mode" do
23 - GraderConfiguration[GraderConfiguration::SINGLE_USER_KEY] = 'true'
23 + GraderConfiguration.find_by(key: GraderConfiguration::SINGLE_USER_KEY).update_attributes(value: 'true')
24 + GraderConfiguration.reload
24 get root_path
25 get root_path
25 assert_response :success
26 assert_response :success
26 post login_login_path, {login: "john", password: "hello" }
27 post login_login_path, {login: "john", password: "hello" }
28 + follow_redirect!
27 assert_redirected_to root_path
29 assert_redirected_to root_path
28 end
30 end
29
31
30 test "root login in in single_user mode" do
32 test "root login in in single_user mode" do
31 - GraderConfiguration[GraderConfiguration::SINGLE_USER_KEY] = 'true'
33 + GraderConfiguration.find_by(key: GraderConfiguration::SINGLE_USER_KEY).update_attributes(value: 'true')
34 + GraderConfiguration.reload
32 get root_path
35 get root_path
33 assert_response :success
36 assert_response :success
34 post login_login_path, {login: "admin", password: "admin" }
37 post login_login_path, {login: "admin", password: "admin" }
@@ -2,6 +2,10
2 require File.expand_path('../../config/environment', __FILE__)
2 require File.expand_path('../../config/environment', __FILE__)
3 require 'rails/test_help'
3 require 'rails/test_help'
4
4
5 + #reporter
6 + require "minitest/reporters"
7 + Minitest::Reporters.use!
8 +
5 class ActiveSupport::TestCase
9 class ActiveSupport::TestCase
6 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
10 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7 #
11 #
You need to be logged in to leave comments. Login now