Skip to content

Commit

Permalink
rename hardware info to last_status_message
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Mar 8, 2024
1 parent 32bca5d commit 5b1e73f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def hardware(authorized=false)
type: hardware_type,
version: hardware_version,
slug: hardware_slug,
info: authorized ? hardware_info : "[FILTERED]",
last_status_message: authorized ? hardware_info : "[FILTERED]",
}
end

Expand Down
14 changes: 7 additions & 7 deletions spec/requests/v0/devices_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
first = create(:device)
second = create(:device)
json = api_get 'devices'
expect(json[0]['hardware']['info']).to eq("[FILTERED]")
expect(json[0]['hardware']['last_status_message']).to eq("[FILTERED]")
end
end

Expand All @@ -65,7 +65,7 @@
first = create(:device)
second = create(:device)
json = api_get 'devices', { access_token: token.token }
expect(json[0]['hardware']['info']).to eq("[FILTERED]")
expect(json[0]['hardware']['last_status_message']).to eq("[FILTERED]")
end
end

Expand All @@ -86,7 +86,7 @@
first = create(:device)
second = create(:device)
json = api_get 'devices', { access_token: admin_token.token}
expect(json[0]['hardware']['info']).not_to eq('[FILTERED]')
expect(json[0]['hardware']['last_status_message']).not_to eq('[FILTERED]')
end
end

Expand Down Expand Up @@ -256,23 +256,23 @@

it "filters hardware info from guests" do
j = api_get "devices/#{device.id}"
expect(j['hardware']['info']).to eq('[FILTERED]')
expect(j['hardware']['last_status_message']).to eq('[FILTERED]')
end

it "filters hardware info from users" do
j = api_get "devices/#{device.id}?access_token=#{token.token}"
expect(j['hardware']['info']).to eq('[FILTERED]')
expect(j['hardware']['last_status_message']).to eq('[FILTERED]')
end

it "exposes hardware info to device owner" do
device = create(:device, owner: user)
j = api_get "devices/#{device.id}?access_token=#{token.token}"
expect(j['hardware']['info']).to eq(device.hardware_info)
expect(j['hardware']['last_status_message']).to eq(device.hardware_info)
end

it "exposes hardware info address to admin" do
j = api_get "devices/#{device.id}?access_token=#{admin_token.token}"
expect(j['hardware']['info']).to eq(device.hardware_info)
expect(j['hardware']['last_status_message']).to eq(device.hardware_info)
end

end
Expand Down

0 comments on commit 5b1e73f

Please sign in to comment.