Improve local seed data with dedicated teacher and student login
* This will also reduce the total number of internal users created through the seeds.
This commit is contained in:
@ -5,16 +5,19 @@ FactoryBot.create(:consumer, name: 'openSAP')
|
|||||||
# users
|
# users
|
||||||
# Set default_url_options explicitly, required for rake task
|
# Set default_url_options explicitly, required for rake task
|
||||||
Rails.application.routes.default_url_options = Rails.application.config.action_mailer.default_url_options
|
Rails.application.routes.default_url_options = Rails.application.config.action_mailer.default_url_options
|
||||||
[:admin, :external_user, :teacher].each { |factory_name| FactoryBot.create(factory_name) }
|
admin = FactoryBot.create(:admin)
|
||||||
|
teacher = FactoryBot.create(:teacher, email: 'teacher@example.org')
|
||||||
|
FactoryBot.create(:learner, email: 'learner@example.org')
|
||||||
|
external_user = FactoryBot.create(:external_user)
|
||||||
|
|
||||||
# execution environments
|
# execution environments
|
||||||
ExecutionEnvironment.create_factories
|
ExecutionEnvironment.create_factories user: admin
|
||||||
|
|
||||||
# exercises
|
# exercises
|
||||||
@exercises = find_factories_by_class(Exercise).map(&:name).map { |factory_name| [factory_name, FactoryBot.create(factory_name)] }.to_h
|
@exercises = find_factories_by_class(Exercise).map(&:name).map { |factory_name| [factory_name, FactoryBot.create(factory_name, user: teacher)] }.to_h
|
||||||
|
|
||||||
# file types
|
# file types
|
||||||
FileType.create_factories
|
FileType.create_factories
|
||||||
|
|
||||||
# submissions
|
# submissions
|
||||||
FactoryBot.create(:submission, exercise: @exercises[:fibonacci])
|
FactoryBot.create(:submission, exercise: @exercises[:fibonacci], user: external_user)
|
||||||
|
@ -42,10 +42,21 @@ cd /home/vagrant/codeocean
|
|||||||
rails s -p 3000 -b 0.0.0.0
|
rails s -p 3000 -b 0.0.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
The default credentials for the administrator are:
|
The default credentials for the internal users are the following:
|
||||||
|
|
||||||
- email: `admin@example.org`
|
- Administrator:
|
||||||
- password: `admin`
|
email: `admin@example.org`
|
||||||
|
password: `admin`
|
||||||
|
- Teacher:
|
||||||
|
email: `teacher@example.org`
|
||||||
|
password: `teacher`
|
||||||
|
- Learner:
|
||||||
|
email: `learner@example.org`
|
||||||
|
password: `learner`
|
||||||
|
|
||||||
|
Additional internal users can be created using the web interface. In development, the activation mail is printed to the console. Use the activation link found in that mail to set a password for a new user.
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
For exporting metrics, start the prometeus exporter by running
|
For exporting metrics, start the prometeus exporter by running
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user