From e532d0ff9cda489e1c40f473c33577e89b2e5edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leandro=20Alem=C3=A3o?= Date: Thu, 19 Dec 2024 16:58:46 +0000 Subject: [PATCH] [CPDLP-3843] Remove NPQRegistrationApiToken --- app/models/npq_registration_api_token.rb | 13 ------------- db/legacy_seeds/dummy_structures.rb | 4 ---- db/new_seeds/base/add_api_tokens.rb | 5 +---- .../api/v1/data_studio/school_rollout_spec.rb | 2 +- 4 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 app/models/npq_registration_api_token.rb diff --git a/app/models/npq_registration_api_token.rb b/app/models/npq_registration_api_token.rb deleted file mode 100644 index a6bd5cb043..0000000000 --- a/app/models/npq_registration_api_token.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class NPQRegistrationApiToken < ApiToken - attribute :private_api_access, default: true - - def owner - "npq_registration_application" - end - - def owner_description - "NPQ registration application" - end -end diff --git a/db/legacy_seeds/dummy_structures.rb b/db/legacy_seeds/dummy_structures.rb index c7432d1fa7..a756b7d76c 100644 --- a/db/legacy_seeds/dummy_structures.rb +++ b/db/legacy_seeds/dummy_structures.rb @@ -238,15 +238,11 @@ # The tokens below have different unhashed version to avoid worrying about clever cryptographic attacks if Rails.env.review? EngageAndLearnApiToken.find_or_create_by!(hashed_token: "dfce9a34c6f982e8adb4b903f8b6064682e6ad1f7858c41ed8a0a7468abc8896") - NPQRegistrationApiToken.find_or_create_by!(hashed_token: "1dae3836ed90df4b796eff1f4a4713247ac5bc8a00352ea46eee621d74cd4fcf") DataStudioApiToken.find_or_create_by!(hashed_token: "c7123fb0e2aecb17e1089e01849d71665983e200e891fe726341a08f176c1d64") elsif Rails.env.development? EngageAndLearnApiToken.find_or_create_by!(hashed_token: "f4a16cd7fc10918fbc7d869d7a83df36059bb98fac7c82502d797b1f1dd73e86") end end -if Rails.env.sandbox? - NPQRegistrationApiToken.find_or_create_by!(hashed_token: "166eaa39950ad15f2f36041cb9062cc8fa9f109945fe9b8378bf904fe35369bc") -end unless Rails.env.sandbox? [ diff --git a/db/new_seeds/base/add_api_tokens.rb b/db/new_seeds/base/add_api_tokens.rb index 588072de7a..e2f246ecf0 100644 --- a/db/new_seeds/base/add_api_tokens.rb +++ b/db/new_seeds/base/add_api_tokens.rb @@ -4,15 +4,12 @@ if Rails.env.in?(%w[review staging]) EngageAndLearnApiToken.find_or_create_by!(hashed_token: "dfce9a34c6f982e8adb4b903f8b6064682e6ad1f7858c41ed8a0a7468abc8896") - NPQRegistrationApiToken.find_or_create_by!(hashed_token: "1dae3836ed90df4b796eff1f4a4713247ac5bc8a00352ea46eee621d74cd4fcf") DataStudioApiToken.find_or_create_by!(hashed_token: "c7123fb0e2aecb17e1089e01849d71665983e200e891fe726341a08f176c1d64") elsif Rails.env.development? EngageAndLearnApiToken.find_or_create_by!(hashed_token: "f4a16cd7fc10918fbc7d869d7a83df36059bb98fac7c82502d797b1f1dd73e86") end -if Rails.env.sandbox? - NPQRegistrationApiToken.find_or_create_by!(hashed_token: "166eaa39950ad15f2f36041cb9062cc8fa9f109945fe9b8378bf904fe35369bc") -else +unless Rails.env.sandbox? { "Ambition Institute" => "ambition-token", "Best Practice Network" => "best-practice-token", diff --git a/spec/requests/api/v1/data_studio/school_rollout_spec.rb b/spec/requests/api/v1/data_studio/school_rollout_spec.rb index 2c25996442..901a0465c0 100644 --- a/spec/requests/api/v1/data_studio/school_rollout_spec.rb +++ b/spec/requests/api/v1/data_studio/school_rollout_spec.rb @@ -57,7 +57,7 @@ end context "using a private token from different scope" do - let(:other_private_token) { NPQRegistrationApiToken.create_with_random_token! } + let(:other_private_token) { DataStudioApiToken.create_with_random_token! } it "returns data successfully" do default_headers[:Authorization] = "Bearer #{other_private_token}"