Include account uuid in api response
Closes PLAT-2484 Test Plan: Exercise the account index and show endpoints. Verify that a parameter named 'uuid' is included in the response and is set to the correct account uuid. Change-Id: I40a30c638fd424d6d9fecacaeeb93f684575fd30 Reviewed-on: https://gerrit.instructure.com/108815 Tested-by: Jenkins Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
parent
dffa3189aa
commit
25baa102e3
|
@ -37,6 +37,11 @@ require 'csv'
|
|||
# "example": "Canvas Account",
|
||||
# "type": "string"
|
||||
# },
|
||||
# "uuid": {
|
||||
# "description": "The UUID of the account",
|
||||
# "example": "WvAHhY5FINzq5IyRIJybGeiXyFkG3SqHUPb7jZY5",
|
||||
# "type": "string"
|
||||
# },
|
||||
# "parent_account_id": {
|
||||
# "description": "The account's parent ID, or null if this is the root account",
|
||||
# "example": 1,
|
||||
|
|
|
@ -1535,8 +1535,6 @@ class Account < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.serialization_excludes; [:uuid]; end
|
||||
|
||||
def find_child(child_id)
|
||||
return all_accounts.find(child_id) if root_account?
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module Api::V1::Account
|
|||
end
|
||||
|
||||
def account_json(account, user, session, includes, read_only=false)
|
||||
attributes = %w(id name parent_account_id root_account_id workflow_state)
|
||||
attributes = %w(id name parent_account_id root_account_id workflow_state uuid)
|
||||
if read_only
|
||||
return api_json(account, user, session, :only => attributes).tap do |hash|
|
||||
hash['default_time_zone'] = account.default_time_zone.tzinfo.name
|
||||
|
|
|
@ -45,6 +45,7 @@ describe "Accounts API", type: :request do
|
|||
expect(json.sort_by { |a| a['id'] }).to eq [
|
||||
{
|
||||
'id' => @a1.id,
|
||||
'uuid' => @a1.uuid,
|
||||
'name' => 'root',
|
||||
'root_account_id' => nil,
|
||||
'parent_account_id' => nil,
|
||||
|
@ -56,6 +57,7 @@ describe "Accounts API", type: :request do
|
|||
},
|
||||
{
|
||||
'id' => @a2.id,
|
||||
'uuid' => @a2.uuid,
|
||||
'integration_id' => nil,
|
||||
'name' => 'subby',
|
||||
'root_account_id' => @a1.id,
|
||||
|
@ -66,7 +68,7 @@ describe "Accounts API", type: :request do
|
|||
'default_storage_quota_mb' => 321,
|
||||
'default_user_storage_quota_mb' => 54,
|
||||
'default_group_storage_quota_mb' => 41,
|
||||
'workflow_state' => 'active',
|
||||
'workflow_state' => 'active'
|
||||
},
|
||||
]
|
||||
end
|
||||
|
@ -87,6 +89,7 @@ describe "Accounts API", type: :request do
|
|||
'default_user_storage_quota_mb' => 45,
|
||||
'default_group_storage_quota_mb' => 42,
|
||||
'workflow_state' => 'active',
|
||||
'uuid' => @a1.uuid
|
||||
},
|
||||
]
|
||||
end
|
||||
|
@ -106,6 +109,7 @@ describe "Accounts API", type: :request do
|
|||
'parent_account_id' => nil,
|
||||
'workflow_state' => 'active',
|
||||
'default_time_zone' => 'Etc/UTC',
|
||||
'uuid' => @a1.uuid
|
||||
},
|
||||
{
|
||||
'id' => @a2.id,
|
||||
|
@ -114,6 +118,7 @@ describe "Accounts API", type: :request do
|
|||
'parent_account_id' => @a1.id,
|
||||
'workflow_state' => 'active',
|
||||
'default_time_zone' => 'America/Juneau',
|
||||
'uuid' => @a2.uuid
|
||||
},
|
||||
]
|
||||
end
|
||||
|
@ -137,6 +142,7 @@ describe "Accounts API", type: :request do
|
|||
'parent_account_id' => nil,
|
||||
'workflow_state' => 'active',
|
||||
'default_time_zone' => 'Etc/UTC',
|
||||
'uuid' => @a1.uuid
|
||||
},
|
||||
{
|
||||
'id' => @a5.global_id,
|
||||
|
@ -145,6 +151,7 @@ describe "Accounts API", type: :request do
|
|||
'parent_account_id' => nil,
|
||||
'workflow_state' => 'active',
|
||||
'default_time_zone' => 'Etc/UTC',
|
||||
'uuid' => @a5.uuid
|
||||
},
|
||||
]
|
||||
end
|
||||
|
@ -233,6 +240,7 @@ describe "Accounts API", type: :request do
|
|||
{
|
||||
'id' => @a1.id,
|
||||
'name' => 'root',
|
||||
'uuid' => @a1.uuid,
|
||||
'root_account_id' => nil,
|
||||
'parent_account_id' => nil,
|
||||
'default_time_zone' => 'Etc/UTC',
|
||||
|
@ -258,6 +266,7 @@ describe "Accounts API", type: :request do
|
|||
'parent_account_id' => nil,
|
||||
'workflow_state' => 'active',
|
||||
'default_time_zone' => 'Etc/UTC',
|
||||
'uuid' => limited.uuid
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
@ -174,6 +174,7 @@ describe "AuthenticationAudit API", type: :request do
|
|||
it "should be formatted as an array of Account objects" do
|
||||
expect(@json).to eq [{
|
||||
"id" => @account.id,
|
||||
"uuid" => @account.uuid,
|
||||
"name" => @account.name,
|
||||
"parent_account_id" => nil,
|
||||
"root_account_id" => nil,
|
||||
|
|
Loading…
Reference in New Issue