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:
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r--spec/requests/api/users_spec.rb43
1 files changed, 31 insertions, 12 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index d70a8bd692d..2a7689eaddf 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -320,6 +320,18 @@ RSpec.describe API::Users do
expect(json_response).to all(include('state' => /(blocked|ldap_blocked)/))
end
+ it "returns an array of external users" do
+ create(:user)
+ external_user = create(:user, external: true)
+
+ get api("/users?external=true", user)
+
+ expect(response).to match_response_schema('public_api/v4/user/basics')
+ expect(response).to include_pagination_headers
+ expect(json_response.size).to eq(1)
+ expect(json_response[0]['id']).to eq(external_user.id)
+ end
+
it "returns one user" do
get api("/users?username=#{omniauth_user.username}", user)
@@ -940,6 +952,18 @@ RSpec.describe API::Users do
expect(new_user.private_profile?).to eq(true)
end
+ it "creates user with view_diffs_file_by_file" do
+ post api('/users', admin), params: attributes_for(:user, view_diffs_file_by_file: true)
+
+ expect(response).to have_gitlab_http_status(:created)
+
+ user_id = json_response['id']
+ new_user = User.find(user_id)
+
+ expect(new_user).not_to eq(nil)
+ expect(new_user.user_preference.view_diffs_file_by_file?).to eq(true)
+ end
+
it "does not create user with invalid email" do
post api('/users', admin),
params: {
@@ -1254,6 +1278,13 @@ RSpec.describe API::Users do
expect(user.reload.private_profile).to eq(true)
end
+ it "updates viewing diffs file by file" do
+ put api("/users/#{user.id}", admin), params: { view_diffs_file_by_file: true }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(user.reload.user_preference.view_diffs_file_by_file?).to eq(true)
+ end
+
it "updates private profile to false when nil is given" do
user.update!(private_profile: true)
@@ -3044,18 +3075,6 @@ RSpec.describe API::Users do
expect(response).to have_gitlab_http_status(:bad_request)
end
-
- context 'when the clear_status_with_quick_options feature flag is disabled' do
- before do
- stub_feature_flags(clear_status_with_quick_options: false)
- end
-
- it 'does not persist clear_status_at' do
- put api('/user/status', user), params: { emoji: 'smirk', message: 'hello world', clear_status_after: '3_hours' }
-
- expect(user.status.reload.clear_status_at).to be_nil
- end
- end
end
end