Skip to content

Commit e981475

Browse files
committed
verify calls to storage_encrypt_channel_id have correct inputs
1 parent 32e70bb commit e981475

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

dashboard/test/controllers/api/v1/projects/public_gallery_controller_test.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ class Api::V1::Projects::PublicGalleryControllerTest < ActionController::TestCas
44
published_applab_project = nil
55
setup do
66
published_applab_project = {
7-
id: 33,
7+
storage_id: 22,
8+
channel_id: 33,
89
published_at: '2017-03-03T00:00:00.000-08:00',
910
project_type: 'applab',
1011
value: {
@@ -95,7 +96,7 @@ class Api::V1::Projects::PublicGalleryControllerTest < ActionController::TestCas
9596
assert_equal 1, categories_list.length
9697
project_row = categories_list['applab'].first
9798
assert_equal 'Charlies App', project_row['name']
98-
assert_equal 'STUB_CHANNEL_ID-1234', project_row['channel']
99+
assert_equal 'STUB_CHANNEL_ID-22-33', project_row['channel']
99100
assert_equal '/v3/files-public/charlies_thumbnail.png', project_row['thumbnailUrl']
100101
assert_equal 'applab', project_row['type']
101102
assert_equal '2017-03-03T00:00:00.000-08:00', project_row['publishedAt']
@@ -128,7 +129,7 @@ class Api::V1::Projects::PublicGalleryControllerTest < ActionController::TestCas
128129

129130
project_row = categories_list['applab'].first
130131
assert_equal 'Charlies App', project_row['name']
131-
assert_equal 'STUB_CHANNEL_ID-1234', project_row['channel']
132+
assert_equal 'STUB_CHANNEL_ID-22-33', project_row['channel']
132133
assert_equal '/v3/files-public/charlies_thumbnail.png', project_row['thumbnailUrl']
133134
assert_equal 'applab', project_row['type']
134135
assert_equal '2017-03-03T00:00:00.000-08:00', project_row['publishedAt']

dashboard/test/controllers/api/v1/projects/section_projects_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Api::V1::Projects::SectionProjectsControllerTest < ActionController::TestC
7373
# this verifies that the hidden project was not shown.
7474
assert_equal 1, projects_list.size
7575
project_row = projects_list.first
76-
assert_equal 'STUB_CHANNEL_ID-1234', project_row['channel']
76+
assert_equal 'STUB_CHANNEL_ID-11-22', project_row['channel']
7777
assert_equal 'Bobs App', project_row['name']
7878
assert_equal @student.name, project_row['studentName']
7979
assert_equal 'applab', project_row['type']

dashboard/test/controllers/xhr_proxy_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class XhrProxyControllerTest < ActionController::TestCase
88
XHR_URI = 'https://www.wikipedia.org/foo?a=1&b=2'
99
XHR_DATA = '{"key1":"value1", "key2":2, "obj":{"x":3, "y":4}}'
1010
XHR_CONTENT_TYPE = 'application/json'
11-
CHANNEL_ID = $stub_encrypted_channel_id
11+
CHANNEL_ID = 'STUB_CHANNEL_ID-1234'
1212
BAD_CHANNEL_MSG = "XhrProxyController request with invalid channel_id"
1313

1414
test "should fetch proxied media with correct content type" do

dashboard/test/test_helper.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,8 @@ def storage_id(_)
450450
SecureRandom.hex
451451
end
452452

453-
$stub_encrypted_channel_id = 'STUB_CHANNEL_ID-1234'
454-
def storage_encrypt_channel_id(_, _)
455-
$stub_encrypted_channel_id
453+
def storage_encrypt_channel_id(storage_id, channel_id)
454+
"STUB_CHANNEL_ID-#{storage_id}-#{channel_id}"
456455
end
457456

458457
$stub_channel_owner = 33

0 commit comments

Comments
 (0)