canvas-lms/spec/factories
Tucker McKnight 1c075e1f0f Save valid site admin registrations and account bindings
This avoids two errors that we found when running the
data fixups in beta.

1. Site admin developer keys have a nil account.
   When we have a dev key with a nil account_id, create
   an Lti::Registration and set the account to
   Account.site_admin. Previously, we would throw an error
   if the account was nil.
2. DevelperKeyAccountBindings *can* be in non-root accounts.
   That is to say, the backend allows it, validation-wise. This is
   probably something that has been done a few times through
   the API unintentionally. When we find a DeveloperKeyAccountBinding
   for a non-root account, we should just skip trying to create
   an Lti::RegistrationAccountBinding for it.
   (Lti::RegistrationAccountBindings must be in a root account.)

Note: in lib/data_fixup/create_lti_registrations_from_developer_keys.rb,
the registration_values hash now has an account_id key instead of
just "account." This is because if the account_id is set to an ID
that doesn't match an account, developer_key.account will be nil,
even though developer_key.account_id is set to some integer. (If
it's a site admin key, developer_key.account_id is nil, and therefore
developer_key.account is also nil. But that's different from having
developer_key.account == nil because the account_id couldn't be found.)
If developer_key.account_id is set to a nonexistent account ID, then
developer_key.account is nil, but the developer key is *not* a
site admin key.

We still want to throw an error if developer_key.account is nil *if*
and only if developer_key.account_id is *not* nil. I.e., the account
is nil and it's not because it's a site admin key.

During the fixup on beta, we did run into a few where
developer_key.account_id was set to a nonexistent account.

test plan:
- specs pass

refs INTEROP-8501
refs INTEROP-8502

fixes INTEROP-8800

flag = lti_registrations_page

Change-Id: Ia3198b21e2b29b5cb9ac75b5f9cbabf492e620f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/355019
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2024-08-15 23:45:49 +00:00
..
account_factory.rb make dynamic settings writable in dev/oss 2024-01-23 15:20:56 +00:00
account_notification_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
admin_analytics_tool_factory.rb Hide admin_analytics when feature flag is turned off 2023-02-21 15:58:02 +00:00
analytics_2_tool_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
announcement_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
assessment_question_bank_factory.rb spec: add count option to question bank helper 2024-03-01 23:11:46 +00:00
assessment_question_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
assessment_request.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
assignment_factory.rb rubocop: Layout/Multiline*LineBreaks 2023-05-01 19:31:42 +00:00
assignment_override_factory.rb include context module overrides in AssignmentOverrideApplicator 2023-09-29 12:54:04 +00:00
attachment_factory.rb bump rubocop gems and apply changes 2023-08-07 20:13:35 +00:00
bookmark_service_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
calendar_event_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
collaboration_factory.rb send lti1p1 migration id in Collaborations LTI 1.3 launches 2024-02-22 17:26:06 +00:00
comment_bank_item_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
communication_channel_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
conversation_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
course_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
course_pace_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
course_section_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
custom_data_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
delayed_message_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
developer_key_factory.rb Save valid site admin registrations and account bindings 2024-08-15 23:45:49 +00:00
discussion_topic_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
enrollment_factory.rb spec: add selenium testing for temporary enrollments 2024-07-23 19:34:26 +00:00
eportfolio_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
external_feed_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
external_tool_factory.rb Include 1.1 ID for module items in 1.3 launch 2024-01-23 17:09:27 +00:00
folder_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
grading_period_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
grading_period_group_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
grading_standard_factory.rb RuboCop: Layout spec 2021-09-22 22:40:24 +00:00
group_category_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
group_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
group_membership_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
late_policy_factory.rb add # frozen_string_literal: true for specs 2020-10-27 20:48:35 +00:00
line_item_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
lti_ims_registration_factory.rb Remove extraneous fields from IMS Registrations 2024-05-02 22:15:17 +00:00
lti_registration_account_binding_factory.rb add API endpoint for LTI registration binding 2024-06-10 22:08:20 +00:00
lti_registration_factory.rb find correct LTI Registration-Account binding 2024-06-26 15:11:08 +00:00
lti_result_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
media_object_factory.rb auto caption speedgrader media upload comments 2024-02-28 16:14:26 +00:00
message_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
notification_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
notification_policy_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
observer_alert_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
observer_alert_threshold_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
outcome_alignment_results_factory.rb Update learning_update_result updated & created live event data 2024-04-08 16:11:45 +00:00
outcome_alignment_stats_factory.rb Update graphql to provide alignment statistics for a course 2022-06-09 19:37:52 +00:00
outcome_calculation_method_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
outcome_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
outcome_friendly_description_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
outcome_proficiency_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
page_view_factory.rb rubocop: Layout/Multiline*LineBreaks 2023-05-01 19:31:42 +00:00
planner_note_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
planner_override_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
pseudonym_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
pseudonym_session_factory.rb bump rubocop gems and apply changes 2023-08-07 20:13:35 +00:00
quiz_factory.rb Data fix up for broken links from LF-203 2024-05-31 20:32:55 +00:00
resource_link_factory.rb expose LTI 1.3 Resource Links via API 2024-07-17 21:01:38 +00:00
role_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
rubric_assessment_factory.rb bundle update rubocop 2023-12-06 14:25:02 +00:00
rubric_association_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
rubric_factory.rb spec: add selenium for rubrics in speedgrader 2024-06-18 21:47:27 +00:00
submission_comment_factory.rb RuboCop: Style/HashSyntax 2021-11-25 14:02:35 +00:00
submission_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
user_factory.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
user_service_factory.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
wiki_page_factory.rb spec: make wiki_page_model reuse @course 2024-03-06 21:57:54 +00:00