diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-04 03:08:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-04 03:08:17 +0300 |
commit | 340fd2966e6565a549f8e611b25d2525fc6929d1 (patch) | |
tree | bfe8876fe6f2a7c78b9e49feec0bf80d8d45bd52 /spec/requests | |
parent | fc92738a0245f1be88250448bebd9c20e9849444 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 1bf2c0c533a..7c0b6ac2e45 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -1242,6 +1242,16 @@ describe API::Users, :do_not_mock_admin_mode do end.to change { user.keys.count }.by(1) end + it 'creates SSH key with `expires_at` attribute' do + optional_attributes = { expires_at: '2016-01-21T00:00:00.000Z' } + attributes = attributes_for(:key).merge(optional_attributes) + + post api("/users/#{user.id}/keys", admin), params: attributes + + expect(response).to have_gitlab_http_status(:created) + expect(json_response['expires_at']).to eq(optional_attributes[:expires_at]) + end + it "returns 400 for invalid ID" do post api("/users/0/keys", admin) expect(response).to have_gitlab_http_status(:bad_request) @@ -1798,6 +1808,16 @@ describe API::Users, :do_not_mock_admin_mode do expect(response).to have_gitlab_http_status(:created) end + it 'creates SSH key with `expires_at` attribute' do + optional_attributes = { expires_at: '2016-01-21T00:00:00.000Z' } + attributes = attributes_for(:key).merge(optional_attributes) + + post api("/user/keys", user), params: attributes + + expect(response).to have_gitlab_http_status(:created) + expect(json_response['expires_at']).to eq(optional_attributes[:expires_at]) + end + it "returns a 401 error if unauthorized" do post api("/user/keys"), params: { title: 'some title', key: 'some key' } expect(response).to have_gitlab_http_status(:unauthorized) |