New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PD: international opt-in additional work #23603
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
581583b
PD: international opt-in page controller tests
breville 8c2c18a
PD: international opt-in gets test that API only works for teachers
breville b2e6d28
PD: international opt-in loses redundant asserts in API controller test
breville e435010
PD: international opt-in small fixes
breville 6c574f3
PD: International opt-in gets link removed for non-teacher accounts
breville a2060c1
PD: international opt-in gets CSD & CSP options
breville ebc35bf
PD: international opt-in gets link to privacy policy
breville File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,31 @@ class Api::V1::Pd::InternationalOptInsControllerTest < ::ActionController::TestC | |
|
||
assert_response :bad_request | ||
end | ||
|
||
test 'students can not create a new international opt-in' do | ||
student = create :student | ||
sign_in student | ||
|
||
assert_does_not_create Pd::InternationalOptIn do | ||
put :create, params: { | ||
form_data: SAMPLE_FORM_DATA, | ||
user: student | ||
} | ||
assert_response :forbidden | ||
end | ||
|
||
assert_response :forbidden | ||
end | ||
|
||
test 'user required to create a new international opt-in' do | ||
assert_does_not_create Pd::InternationalOptIn do | ||
put :create, params: { | ||
form_data: SAMPLE_FORM_DATA, | ||
user: nil | ||
} | ||
assert_response :redirect | ||
end | ||
|
||
assert_response :redirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this too, with line 81 |
||
end | ||
end |
32 changes: 32 additions & 0 deletions
32
dashboard/test/controllers/pd/international_opt_in_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'test_helper' | ||
|
||
class Pd::InternationalOptInControllerTest < ::ActionController::TestCase | ||
self.use_transactional_test_case = true | ||
|
||
test 'signed in teacher' do | ||
teacher = create :teacher | ||
sign_in teacher | ||
get :new | ||
assert_response :success | ||
end | ||
|
||
test 'signed out' do | ||
get :new | ||
assert_template 'pd/application/teacher_application/logged_out' | ||
end | ||
|
||
test 'signed in student' do | ||
sign_in create :student | ||
get :new | ||
assert_template 'pd/application/teacher_application/not_teacher' | ||
end | ||
|
||
test 'signed in teacher with no email' do | ||
teacher = create :teacher | ||
teacher.email = "" | ||
teacher.save(validate: false) | ||
sign_in teacher | ||
get :new | ||
assert_template 'pd/application/teacher_application/no_teacher_email' | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is redundant w line 69