diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-07 21:56:40 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-07 21:56:40 +0300 |
commit | 168b3e973f020105b4ca53a94367c572146c3faa (patch) | |
tree | 5605d182016f827e47c5032a1459bcf6135b42bb /spec | |
parent | 815cec3ea75ef38e15a1c75cee184ffee995a630 (diff) | |
parent | 631a30276e30354cfde6b759527abbb26ff6cf96 (diff) |
Merge branch 'fix-api-private-project-update' into 'master'
Fix API setting of 'public' attribute to false will make a project private
There is a bug in the projects API where setting `public` to `false` of would not change `visibility_level` even if `visiblity_level` were not present.
Closes #3864
See merge request !1996
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index c59ee7af8ab..24b765f4979 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -742,6 +742,18 @@ describe API::API, api: true do end end + it 'should update visibility_level from public to private' do + project3.update_attributes({ visibility_level: Gitlab::VisibilityLevel::PUBLIC }) + + project_param = { public: false } + put api("/projects/#{project3.id}", user), project_param + expect(response.status).to eq(200) + project_param.each_pair do |k, v| + expect(json_response[k.to_s]).to eq(v) + end + expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE) + end + it 'should not update name to existing name' do project_param = { name: project3.name } put api("/projects/#{project.id}", user), project_param |