Outcomes Import API: Expose ISTE standards

Expose ISTE standards as available standards when clients request the
list of standards available to import

Fixes CNVS-23789

Test Plan:

    - Make an API request to the "available" action of the
      OutcomesImportController:

      curl -H "Authorization: Bearer <your-key>"
      http://<canvas-domain>/api/v1/outcomes_import/available

    - Observe that the ISTE standards are in the list.  There should be
      three: "NETS for Administrators, NETS for Teachers, NETS for
      Students"

Change-Id: I07597719596269e06eb6773ba298c453b6626e0b
Reviewed-on: https://gerrit.instructure.com/64481
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
QA-Review: Benjamin Porter <bporter@instructure.com>
This commit is contained in:
Benjamin Porter 2015-10-01 19:26:55 -08:00
parent fde44bd840
commit bce1c3fd3f
4 changed files with 84 additions and 37 deletions

View File

@ -129,7 +129,7 @@ class OutcomesImportApiController < ApplicationController
authorities.sort{ |a, b| a["title"] <=> b["title"] }
end
def extract_common_core_and_ngss(api, nat_stds_guid)
def extract_nat_stds(api, nat_stds_guid)
api.browse_guid(nat_stds_guid).first["itm"].first["itm"]
end
@ -141,8 +141,9 @@ class OutcomesImportApiController < ApplicationController
api = api_connection
auth_list = retrieve_authorities(api)
# prepend the common core and next gen science standards to the list
auth_list.unshift(extract_common_core_and_ngss(api, nat_stds_guid(auth_list)))
# prepend the common core, next gen science standards,
# and the ISTE (NETS) standards to the list
auth_list.unshift(extract_nat_stds(api, nat_stds_guid(auth_list)))
# append the UK standards to the end of the list and flatten it down
auth_list.push(uk_guid(api)).flatten

View File

@ -1,13 +1,11 @@
[
{
"title": "United States",
"guid": "4850ad62",
"type" : "country",
"itm" : [
{
"title": "National Standards",
"guid": "18d9f221",
"guid" : "987654321",
"type" : "authority",
"title" : "National Standards",
"itm" : [
{
"title" : "Common Core State Standards",
@ -26,9 +24,29 @@
"guid" : "923ce7bf",
"type" : "document",
"chld" : "1"
},
{
"title" : "NETS for Administrators",
"guid" : "923ce7ba",
"type" : "document",
"chld" : "1"
},
{
"title" : "NETS for Teachers",
"guid" : "923ce7bb",
"type" : "document",
"chld" : "1"
},
{
"title" : "NETS for Students",
"guid" : "923ce7bc",
"type" : "document",
"chld" : "1"
}
]
}
]
],
"title" : "United States",
"guid" : "123456789"
}
]

View File

@ -17,6 +17,24 @@
"type": "document",
"chld": "1"
},
{
"title": "NETS for Administrators",
"guid": "923ce7ba",
"type": "document",
"chld": "1"
},
{
"title": "NETS for Teachers",
"guid": "923ce7bb",
"type": "document",
"chld": "1"
},
{
"title": "NETS for Students",
"guid": "923ce7bc",
"type": "document",
"chld": "1"
},
{
"title": "Alabama",
"guid": "46bb3879",

View File

@ -162,6 +162,16 @@ describe "Outcomes Import API", type: :request do
expect(available_json.any?{|j| j["title"] =~ /common core/i}).to be_truthy
end
it "includes the NGSS standards" do
expect(available_json.any?{|j| j["title"] =~ /ngss/i}).to be_truthy
end
%w[Administrators Teachers Students].each do |group|
it "includes the ISTE standards for #{group}" do
expect(available_json.any?{|j| j["title"] == "NETS for #{group}"}).to be_truthy
end
end
it "requires the user to have manage_global_outcomes permissions" do
revoke_permission(@account_user, :manage_global_outcomes)
available_json(expected_status: 401)