Skip to content

Commit eacfe13

Browse files
author
Matt Muller
committed
Fix smithy spec
1 parent 70a1ea5 commit eacfe13

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

gems/smithy/spec/interfaces/client/auth_resolver_spec.rb

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@
1515
it 'returns the auth options alphabetically by default' do
1616
params = NoAuthTrait::AuthParameters.new(operation_name: :operation_a)
1717
auth_options = subject.resolve(params)
18-
expected = %w[smithy.api#httpBasicAuth smithy.api#httpBearerAuth smithy.api#httpDigestAuth]
18+
expected = [
19+
{ scheme_id: 'smithy.api#httpBasicAuth' },
20+
{ scheme_id: 'smithy.api#httpBearerAuth' },
21+
{ scheme_id: 'smithy.api#httpDigestAuth' }
22+
]
1923
expect(auth_options).to eq(expected)
2024
end
2125

2226
it 'returns the auth options for the operation with the auth trait' do
2327
params = NoAuthTrait::AuthParameters.new(operation_name: :operation_b)
2428
auth_options = subject.resolve(params)
25-
expect(auth_options).to eq(['smithy.api#httpDigestAuth'])
29+
expect(auth_options).to eq([{ scheme_id: 'smithy.api#httpDigestAuth' }])
2630
end
2731

2832
it 'returns the auth options for the operation with the optionalAuth trait' do
2933
params = NoAuthTrait::AuthParameters.new(operation_name: :operation_g)
3034
auth_options = subject.resolve(params)
3135
expect(auth_options).to eq(
32-
%w[
33-
smithy.api#httpBasicAuth
34-
smithy.api#httpBearerAuth
35-
smithy.api#httpDigestAuth
36-
smithy.api#noAuth
36+
[
37+
{ scheme_id: 'smithy.api#httpBasicAuth' },
38+
{ scheme_id: 'smithy.api#httpBearerAuth' },
39+
{ scheme_id: 'smithy.api#httpDigestAuth' },
40+
{ scheme_id: 'smithy.api#noAuth' }
3741
]
3842
)
3943
end
@@ -49,26 +53,32 @@
4953
it 'returns the auth options with the service auth trait' do
5054
params = AuthTrait::AuthParameters.new(operation_name: :operation_c)
5155
auth_options = subject.resolve(params)
52-
expected = %w[smithy.api#httpBasicAuth smithy.api#httpDigestAuth]
56+
expected = [{ scheme_id: 'smithy.api#httpBasicAuth' }, { scheme_id: 'smithy.api#httpDigestAuth' }]
5357
expect(auth_options).to eq(expected)
5458
end
5559

5660
it 'returns the auth options for the operation overriding the service auth trait' do
5761
params = AuthTrait::AuthParameters.new(operation_name: :operation_d)
5862
auth_options = subject.resolve(params)
59-
expect(auth_options).to eq(['smithy.api#httpBearerAuth'])
63+
expect(auth_options).to eq([{ scheme_id: 'smithy.api#httpBearerAuth' }])
6064
end
6165

6266
it 'returns a noAuth option when the auth trait is empty' do
6367
params = AuthTrait::AuthParameters.new(operation_name: :operation_e)
6468
auth_options = subject.resolve(params)
65-
expect(auth_options).to eq(['smithy.api#noAuth'])
69+
expect(auth_options).to eq([{ scheme_id: 'smithy.api#noAuth' }])
6670
end
6771

6872
it 'returns the auth options for the operation with the optionalAuth trait' do
6973
params = AuthTrait::AuthParameters.new(operation_name: :operation_f)
7074
auth_options = subject.resolve(params)
71-
expect(auth_options).to eq(%w[smithy.api#httpBasicAuth smithy.api#httpDigestAuth smithy.api#noAuth])
75+
expect(auth_options).to eq(
76+
[
77+
{ scheme_id: 'smithy.api#httpBasicAuth' },
78+
{ scheme_id: 'smithy.api#httpDigestAuth' },
79+
{ scheme_id: 'smithy.api#noAuth' }
80+
]
81+
)
7282
end
7383
end
7484
end
@@ -82,13 +92,13 @@
8292
it 'returns the auth options for the operation with no auth traits' do
8393
params = NoAuth::AuthParameters.new(operation_name: :operation_h)
8494
auth_options = subject.resolve(params)
85-
expect(auth_options).to eq(['smithy.api#noAuth'])
95+
expect(auth_options).to eq([{ scheme_id: 'smithy.api#noAuth' }])
8696
end
8797

8898
it 'returns the auth options for the operation with the optionalAuth trait' do
8999
params = NoAuth::AuthParameters.new(operation_name: :operation_i)
90100
auth_options = subject.resolve(params)
91-
expect(auth_options).to eq(['smithy.api#noAuth'])
101+
expect(auth_options).to eq([{ scheme_id: 'smithy.api#noAuth' }])
92102
end
93103
end
94104
end

gems/smithy/spec/interfaces/welds/auth_schemes_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def remove_auth_schemes
3636
auth_resolver = ServiceWithAuthTrait::AuthResolver.new
3737
auth_parameters = ServiceWithAuthTrait::AuthParameters.new(operation_name: :operation_c)
3838
resolved_auths = auth_resolver.resolve(auth_parameters)
39-
expect(resolved_auths).to include('smithy.api#httpBasicAuth')
39+
expect(resolved_auths).to include({ scheme_id: 'smithy.api#httpBasicAuth' })
4040
end
4141

4242
it 'removes auth schemes from the client' do
4343
auth_resolver = ServiceWithAuthTrait::AuthResolver.new
4444
auth_parameters = ServiceWithAuthTrait::AuthParameters.new(operation_name: :operation_d)
4545
resolved_auths = auth_resolver.resolve(auth_parameters)
46-
expect(resolved_auths).to_not include('smithy.api#httpBearerAuth')
46+
expect(resolved_auths).to_not include({ scheme_id: 'smithy.api#httpBearerAuth' })
4747
end
4848
end
4949
end

0 commit comments

Comments
 (0)