Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e9aec1ec
Commit
e9aec1ec
authored
Nov 28, 2019
by
jackie_fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow valid namespace paths with dots for api PUT
parent
d6db5727
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
7 deletions
+35
-7
ee/changelogs/unreleased/allow_dots_in_namespace_path_for_puts.yml
...logs/unreleased/allow_dots_in_namespace_path_for_puts.yml
+5
-0
ee/lib/ee/api/namespaces.rb
ee/lib/ee/api/namespaces.rb
+1
-1
ee/spec/requests/api/namespaces_spec.rb
ee/spec/requests/api/namespaces_spec.rb
+29
-6
No files found.
ee/changelogs/unreleased/allow_dots_in_namespace_path_for_puts.yml
0 → 100644
View file @
e9aec1ec
---
title
:
Allow valid namespace paths with dots for api PUT
merge_request
:
20079
author
:
type
:
fixed
ee/lib/ee/api/namespaces.rb
View file @
e9aec1ec
...
...
@@ -33,7 +33,7 @@ module EE
end
end
resource
:namespaces
do
resource
:namespaces
,
requirements:
::
API
::
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
helpers
do
params
:gitlab_subscription_optional_attributes
do
optional
:seats
,
type:
Integer
,
default:
0
,
desc:
'The number of seats purchased'
...
...
ee/spec/requests/api/namespaces_spec.rb
View file @
e9aec1ec
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
describe
API
::
Namespaces
do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:group1
)
{
create
(
:group
)
}
let!
(
:group1
)
{
create
(
:group
,
name:
'test.test-group.2'
)
}
let!
(
:group2
)
{
create
(
:group
,
:nested
)
}
let!
(
:gold_plan
)
{
create
(
:gold_plan
)
}
...
...
@@ -116,12 +116,14 @@ describe API::Namespaces do
end
context
'when authenticated as admin'
do
it
'updates namespace using full_path'
do
it
'updates namespace using full_path
when full_path contains dots
'
do
put
api
(
"/namespaces/
#{
group1
.
full_path
}
"
,
admin
),
params:
{
plan:
'silver'
,
shared_runners_minutes_limit:
9001
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'plan'
]).
to
eq
(
'silver'
)
expect
(
json_response
[
'shared_runners_minutes_limit'
]).
to
eq
(
9001
)
aggregate_failures
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'plan'
]).
to
eq
(
'silver'
)
expect
(
json_response
[
'shared_runners_minutes_limit'
]).
to
eq
(
9001
)
end
end
it
'updates namespace using id'
do
...
...
@@ -217,6 +219,15 @@ describe API::Namespaces do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
group1
.
gitlab_subscription
).
to
be_present
end
it
'creates a subscription using full_path when the namespace path contains dots'
do
post
api
(
"/namespaces/
#{
group1
.
full_path
}
/gitlab_subscription"
,
admin
),
params:
params
aggregate_failures
do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
group1
.
gitlab_subscription
).
to
be_present
end
end
end
end
...
...
@@ -251,6 +262,12 @@ describe API::Namespaces do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
'is successful using full_path when namespace path contains dots'
do
get
api
(
"/namespaces/
#{
group1
.
full_path
}
/gitlab_subscription"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
'returns data in a proper format'
do
do_get
(
owner
)
...
...
@@ -271,7 +288,7 @@ describe API::Namespaces do
put
api
(
"/namespaces/
#{
namespace_id
}
/gitlab_subscription"
,
current_user
),
params:
payload
end
set
(
:namespace
)
{
create
(
:group
)
}
set
(
:namespace
)
{
create
(
:group
,
name:
'test.test-group.22'
)
}
set
(
:gitlab_subscription
)
{
create
(
:gitlab_subscription
,
namespace:
namespace
)
}
let
(
:params
)
do
...
...
@@ -327,6 +344,12 @@ describe API::Namespaces do
expect
(
gitlab_subscription
.
plan_name
).
to
eq
(
'silver'
)
expect
(
gitlab_subscription
.
plan_title
).
to
eq
(
'Silver'
)
end
it
'is sucessful using full_path when namespace path contains dots'
do
put
api
(
"/namespaces/
#{
namespace
.
full_path
}
/gitlab_subscription"
,
admin
),
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment