refactor: cleanup group order articles

This commit is contained in:
Philipp Rothmann 2022-12-14 16:43:05 +01:00
parent 5201d1740c
commit e4d0222ae2
1 changed files with 8 additions and 20 deletions

View File

@ -75,7 +75,6 @@ describe 'User', type: :request do
run_test! run_test!
end end
# 422
response '422', 'invalid parameter value or group order article already exists' do response '422', 'invalid parameter value or group order article already exists' do
let(:group_order_article) { { order_article_id: goa.order_article_id, quantity: 1, tolerance: 2 } } let(:group_order_article) { { order_article_id: goa.order_article_id, quantity: 1, tolerance: 2 } }
schema '$ref' => '#/components/schemas/Error422' schema '$ref' => '#/components/schemas/Error422'
@ -127,42 +126,35 @@ describe 'User', type: :request do
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {
group_order_article_for_create: { group_order_article: {
type: :object, '$ref': '#/components/schemas/GroupOrderArticle'
items: { }
}
run_test!
end
}
}
}
run_test!
end
# 401
response 401, 'not logged-in' do response 401, 'not logged-in' do
let(:Authorization) { 'abc' }
schema '$ref' => '#/components/schemas/Error401' schema '$ref' => '#/components/schemas/Error401'
let(:Authorization) { 'abc' }
run_test! run_test!
end end
# 403
response 403, 'user has no ordergroup, order not open, is below minimum balance, has not enough apple points, or missing scope' do response 403, 'user has no ordergroup, order not open, is below minimum balance, has not enough apple points, or missing scope' do
let(:api_scopes) { ['none'] } let(:api_scopes) { ['none'] }
schema '$ref' => '#/components/schemas/Error403' schema '$ref' => '#/components/schemas/Error403'
run_test! run_test!
end end
# 404
response '404', 'order article not found in open orders' do response '404', 'order article not found in open orders' do
schema type: :object, properties: { schema type: :object, properties: {
group_order_article: { group_order_article: {
type: :object,
items: {
'$ref': '#/components/schemas/GroupOrderArticle' '$ref': '#/components/schemas/GroupOrderArticle'
} }
} }
}
let(:id) { 'invalid' } let(:id) { 'invalid' }
run_test! run_test!
end end
# 422
response '422', 'invalid parameter value' do response '422', 'invalid parameter value' do
let(:group_order_article) { { order_article_id: 'invalid', quantity: -5, tolerance: 'invalid' } } let(:group_order_article) { { order_article_id: 'invalid', quantity: -5, tolerance: 'invalid' } }
schema '$ref' => '#/components/schemas/Error422' schema '$ref' => '#/components/schemas/Error422'
@ -180,19 +172,15 @@ describe 'User', type: :request do
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {
group_order_article: { group_order_article: {
type: :object,
items: {
'$ref': '#/components/schemas/GroupOrderArticle' '$ref': '#/components/schemas/GroupOrderArticle'
} }
} }
}
let(:id) { goa.id } let(:id) { goa.id }
run_test! run_test!
end end
it_handles_invalid_token_with_id it_handles_invalid_token_with_id
# 403
response 403, 'user has no ordergroup, order not open, is below minimum balance, has not enough apple points, or missing scope' do response 403, 'user has no ordergroup, order not open, is below minimum balance, has not enough apple points, or missing scope' do
let(:api_scopes) { ['none'] } let(:api_scopes) { ['none'] }
schema '$ref' => '#/components/schemas/Error403' schema '$ref' => '#/components/schemas/Error403'