Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 03:09:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 03:09:12 +0300
commit6168721025dd8e98caeb2bf6844273e6690eaf69 (patch)
tree8c4fb20d793669e488a739bc9951dab8b363eed4 /spec/requests/api/users_spec.rb
parenta89cb5cbdd832d4d9e80517973aceda6bc0a3856 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r--spec/requests/api/users_spec.rb39
1 files changed, 38 insertions, 1 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index f6ff2020c79..aa8dd021707 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -461,7 +461,7 @@ describe API::Users do
end
it "creates user with optional attributes" do
- optional_attributes = { confirm: true }
+ optional_attributes = { confirm: true, theme_id: 2, color_scheme_id: 4 }
attributes = attributes_for(:user).merge(optional_attributes)
post api('/users', admin), params: attributes
@@ -576,6 +576,15 @@ describe API::Users do
expect(response).to have_gitlab_http_status(400)
end
+ it "doesn't create user with invalid optional attributes" do
+ optional_attributes = { theme_id: 50, color_scheme_id: 50 }
+ attributes = attributes_for(:user).merge(optional_attributes)
+
+ post api('/users', admin), params: attributes
+
+ expect(response).to have_gitlab_http_status(400)
+ end
+
it 'returns 400 error if user does not validate' do
post api('/users', admin),
params: {
@@ -824,6 +833,34 @@ describe API::Users do
expect(user.reload.email).not_to eq('invalid email')
end
+ it "updates theme id" do
+ put api("/users/#{user.id}", admin), params: { theme_id: 5 }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(user.reload.theme_id).to eq(5)
+ end
+
+ it "does not update invalid theme id" do
+ put api("/users/#{user.id}", admin), params: { theme_id: 50 }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(user.reload.theme_id).not_to eq(50)
+ end
+
+ it "updates color scheme id" do
+ put api("/users/#{user.id}", admin), params: { color_scheme_id: 5 }
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(user.reload.color_scheme_id).to eq(5)
+ end
+
+ it "does not update invalid color scheme id" do
+ put api("/users/#{user.id}", admin), params: { color_scheme_id: 50 }
+
+ expect(response).to have_gitlab_http_status(400)
+ expect(user.reload.color_scheme_id).not_to eq(50)
+ end
+
context 'when the current user is not an admin' do
it "is not available" do
expect do