Skip to content
Snippets Groups Projects
Commit f7dae0cd authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent b98fa9ef
No related branches found
No related tags found
No related merge requests found
Showing
with 462 additions and 187 deletions
Loading
@@ -118,7 +118,31 @@ button.addEventListener('click', () => {
Loading
@@ -118,7 +118,31 @@ button.addEventListener('click', () => {
   
## Tests and test helpers ## Tests and test helpers
   
In Karma tests, you can use the following: In Jest particularly in vue tests, you can use the following:
```javascript
import { mockTracking } from 'helpers/tracking_helper';
describe('MyTracking', () => {
let spy;
beforeEach(() => {
spy = mockTracking('_category_', wrapper.element, jest.spyOn);
});
it('tracks an event when clicked on feedback', () => {
wrapper.find('.discover-feedback-icon').trigger('click');
expect(spy).toHaveBeenCalledWith('_category_', 'click_button', {
label: 'security-discover-feedback-cta',
property: '0',
});
});
});
```
In obsolete Karma tests it's used as below:
   
```javascript ```javascript
import { mockTracking, triggerEvent } from 'spec/helpers/tracking_helper'; import { mockTracking, triggerEvent } from 'spec/helpers/tracking_helper';
Loading
Loading
Loading
@@ -30,7 +30,7 @@ instances (GitLab Core, Starter, Premium, and Ultimate).
Loading
@@ -30,7 +30,7 @@ instances (GitLab Core, Starter, Premium, and Ultimate).
<div class="col-md-9"> <div class="col-md-9">
<p style="margin-top: 18px;"> <p style="margin-top: 18px;">
To publish a website with Pages, you can use any Static Site Generator (SSG), To publish a website with Pages, you can use any Static Site Generator (SSG),
such as Jekyll, Hugo, Middleman, Harp, Hexo, and Brunch, just to name a few. You can also such as Gatsby, Jekyll, Hugo, Middleman, Harp, Hexo, and Brunch, just to name a few. You can also
publish any website written directly in plain HTML, CSS, and JavaScript.</p> publish any website written directly in plain HTML, CSS, and JavaScript.</p>
<p>Pages does <strong>not</strong> support dynamic server-side processing, for instance, as <code>.php</code> and <code>.asp</code> requires. See this article to learn more about <p>Pages does <strong>not</strong> support dynamic server-side processing, for instance, as <code>.php</code> and <code>.asp</code> requires. See this article to learn more about
<a href="https://about.gitlab.com/blog/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/">static websites vs dynamic websites</a>.</p> <a href="https://about.gitlab.com/blog/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/">static websites vs dynamic websites</a>.</p>
Loading
Loading
Loading
@@ -182,9 +182,14 @@ If **Public pipelines** is disabled:
Loading
@@ -182,9 +182,14 @@ If **Public pipelines** is disabled:
   
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9362) in GitLab 9.1. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9362) in GitLab 9.1.
   
If you want to auto-cancel all pending non-HEAD pipelines on branch, when If you want all pending non-HEAD pipelines on branches to auto-cancel each time
new pipeline will be created (after your Git push or manually from UI), a new pipeline is created, such as after a Git push or manually from the UI,
check **Auto-cancel pending pipelines** checkbox and save the changes. you can enable this in the project settings:
1. Go to **{settings}** **Settings > CI / CD**.
1. Expand **General Pipelines**.
1. Check the **Auto-cancel redundant, pending pipelines** checkbox.
1. Click **Save changes**.
   
## Pipeline Badges ## Pipeline Badges
   
Loading
Loading
Loading
@@ -44,6 +44,7 @@ module Gitlab
Loading
@@ -44,6 +44,7 @@ module Gitlab
ProjectTemplate.new('dotnetcore', '.NET Core', _('A .NET Core console application template, customizable for any .NET Core project'), 'https://gitlab.com/gitlab-org/project-templates/dotnetcore', 'illustrations/logos/dotnet.svg'), ProjectTemplate.new('dotnetcore', '.NET Core', _('A .NET Core console application template, customizable for any .NET Core project'), 'https://gitlab.com/gitlab-org/project-templates/dotnetcore', 'illustrations/logos/dotnet.svg'),
ProjectTemplate.new('android', 'Android', _('A ready-to-go template for use with Android apps.'), 'https://gitlab.com/gitlab-org/project-templates/android', 'illustrations/logos/android.svg'), ProjectTemplate.new('android', 'Android', _('A ready-to-go template for use with Android apps.'), 'https://gitlab.com/gitlab-org/project-templates/android', 'illustrations/logos/android.svg'),
ProjectTemplate.new('gomicro', 'Go Micro', _('Go Micro is a framework for micro service development.'), 'https://gitlab.com/gitlab-org/project-templates/go-micro'), ProjectTemplate.new('gomicro', 'Go Micro', _('Go Micro is a framework for micro service development.'), 'https://gitlab.com/gitlab-org/project-templates/go-micro'),
ProjectTemplate.new('gatsby', 'Pages/Gatsby', _('Everything you need to create a GitLab Pages site using Gatsby.'), 'https://gitlab.com/pages/gatsby'),
ProjectTemplate.new('hugo', 'Pages/Hugo', _('Everything you need to create a GitLab Pages site using Hugo.'), 'https://gitlab.com/pages/hugo'), ProjectTemplate.new('hugo', 'Pages/Hugo', _('Everything you need to create a GitLab Pages site using Hugo.'), 'https://gitlab.com/pages/hugo'),
ProjectTemplate.new('jekyll', 'Pages/Jekyll', _('Everything you need to create a GitLab Pages site using Jekyll.'), 'https://gitlab.com/pages/jekyll'), ProjectTemplate.new('jekyll', 'Pages/Jekyll', _('Everything you need to create a GitLab Pages site using Jekyll.'), 'https://gitlab.com/pages/jekyll'),
ProjectTemplate.new('plainhtml', 'Pages/Plain HTML', _('Everything you need to create a GitLab Pages site using plain HTML.'), 'https://gitlab.com/pages/plain-html'), ProjectTemplate.new('plainhtml', 'Pages/Plain HTML', _('Everything you need to create a GitLab Pages site using plain HTML.'), 'https://gitlab.com/pages/plain-html'),
Loading
Loading
Loading
@@ -7924,6 +7924,9 @@ msgstr ""
Loading
@@ -7924,6 +7924,9 @@ msgstr ""
msgid "Everything on your to-do list is marked as done." msgid "Everything on your to-do list is marked as done."
msgstr "" msgstr ""
   
msgid "Everything you need to create a GitLab Pages site using Gatsby."
msgstr ""
msgid "Everything you need to create a GitLab Pages site using GitBook." msgid "Everything you need to create a GitLab Pages site using GitBook."
msgstr "" msgstr ""
   
Loading
@@ -15206,6 +15209,9 @@ msgstr ""
Loading
@@ -15206,6 +15209,9 @@ msgstr ""
msgid "ProjectTemplates|NodeJS Express" msgid "ProjectTemplates|NodeJS Express"
msgstr "" msgstr ""
   
msgid "ProjectTemplates|Pages/Gatsby"
msgstr ""
msgid "ProjectTemplates|Pages/GitBook" msgid "ProjectTemplates|Pages/GitBook"
msgstr "" msgstr ""
   
Loading
@@ -18558,6 +18564,9 @@ msgstr ""
Loading
@@ -18558,6 +18564,9 @@ msgstr ""
msgid "Subscription deletion failed." msgid "Subscription deletion failed."
msgstr "" msgstr ""
   
msgid "Subscription successfully applied to \"%{group_name}\""
msgstr ""
msgid "Subscription successfully created." msgid "Subscription successfully created."
msgstr "" msgstr ""
   
Loading
Loading
Loading
@@ -37,6 +37,7 @@ describe 'Environments page', :js do
Loading
@@ -37,6 +37,7 @@ describe 'Environments page', :js do
   
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
expect(page.all('.environment-name').length).to eq(1) expect(page.all('.environment-name').length).to eq(1)
expect(page.all('.ic-stop').length).to eq(1)
end end
end end
   
Loading
@@ -105,6 +106,7 @@ describe 'Environments page', :js do
Loading
@@ -105,6 +106,7 @@ describe 'Environments page', :js do
   
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
expect(page.all('.environment-name').length).to eq(1) expect(page.all('.environment-name').length).to eq(1)
expect(page.all('.ic-stop').length).to eq(0)
end end
end end
end end
Loading
Loading
import Vue from 'vue';
import initConfirmModal from '~/confirm_modal';
import { TEST_HOST } from 'helpers/test_constants';
describe('ConfirmModal', () => {
const buttons = [
{
path: `${TEST_HOST}/1`,
method: 'delete',
modalAttributes: {
modalId: 'geo-entry-removal-modal',
title: 'Remove tracking database entry',
message: 'Tracking database entry will be removed. Are you sure?',
okVariant: 'danger',
okTitle: 'Remove entry',
},
},
{
path: `${TEST_HOST}/1`,
method: 'post',
modalAttributes: {
modalId: 'geo-entry-removal-modal',
title: 'Update tracking database entry',
message: 'Tracking database entry will be updated. Are you sure?',
okVariant: 'success',
okTitle: 'Update entry',
},
},
];
beforeEach(() => {
const buttonContainer = document.createElement('div');
buttons.forEach(x => {
const button = document.createElement('button');
button.setAttribute('class', 'js-confirm-modal-button');
button.setAttribute('data-path', x.path);
button.setAttribute('data-method', x.method);
button.setAttribute('data-modal-attributes', JSON.stringify(x.modalAttributes));
button.innerHTML = 'Action';
buttonContainer.appendChild(button);
});
document.body.appendChild(buttonContainer);
});
afterEach(() => {
document.body.innerHTML = '';
});
const findJsHooks = () => document.querySelectorAll('.js-confirm-modal-button');
const findModal = () => document.querySelector('.gl-modal');
const findModalOkButton = (modal, variant) =>
modal.querySelector(`.modal-footer .btn-${variant}`);
const findModalCancelButton = modal => modal.querySelector('.modal-footer .btn-secondary');
const serializeModal = (modal, buttonIndex) => {
const { modalAttributes } = buttons[buttonIndex];
return {
path: modal.querySelector('form').action,
method: modal.querySelector('input[name="_method"]').value,
modalAttributes: {
modalId: modal.id,
title: modal.querySelector('.modal-title').innerHTML,
message: modal.querySelector('.modal-body div').innerHTML,
okVariant: [...findModalOkButton(modal, modalAttributes.okVariant).classList]
.find(x => x.match('btn-'))
.replace('btn-', ''),
okTitle: findModalOkButton(modal, modalAttributes.okVariant).innerHTML,
},
};
};
it('starts with only JsHooks', () => {
expect(findJsHooks()).toHaveLength(buttons.length);
expect(findModal()).not.toExist();
});
describe('when button clicked', () => {
beforeEach(() => {
initConfirmModal();
findJsHooks()
.item(0)
.click();
});
it('does not replace JsHook with GlModal', () => {
expect(findJsHooks()).toHaveLength(buttons.length);
});
describe('GlModal', () => {
it('is rendered', () => {
expect(findModal()).toExist();
});
describe('Cancel Button', () => {
beforeEach(() => {
findModalCancelButton(findModal()).click();
return Vue.nextTick();
});
it('closes the modal', () => {
expect(findModal()).not.toExist();
});
});
});
});
describe.each`
index
${0}
${1}
`(`when multiple buttons exist`, ({ index }) => {
beforeEach(() => {
initConfirmModal();
findJsHooks()
.item(index)
.click();
});
it('correct props are passed to gl-modal', () => {
expect(serializeModal(findModal(), index)).toEqual(buttons[index]);
});
});
});
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import $ from 'jquery';
import '~/commons/bootstrap';
import * as datetimeUtility from '~/lib/utils/datetime_utility'; import * as datetimeUtility from '~/lib/utils/datetime_utility';
   
describe('Date time utils', () => { describe('Date time utils', () => {
Loading
@@ -563,3 +565,23 @@ describe('approximateDuration', () => {
Loading
@@ -563,3 +565,23 @@ describe('approximateDuration', () => {
expect(datetimeUtility.approximateDuration(seconds)).toBe(approximation); expect(datetimeUtility.approximateDuration(seconds)).toBe(approximation);
}); });
}); });
describe('localTimeAgo', () => {
beforeEach(() => {
document.body.innerHTML = `<time title="some time" datetime="2020-02-18T22:22:32Z">1 hour ago</time>`;
});
it.each`
timeagoArg | title | dataOriginalTitle
${false} | ${'some time'} | ${null}
${true} | ${''} | ${'Feb 18, 2020 10:22pm GMT+0000'}
`('converts $seconds seconds to $approximation', ({ timeagoArg, title, dataOriginalTitle }) => {
const element = document.querySelector('time');
datetimeUtility.localTimeAgo($(element), timeagoArg);
jest.runAllTimers();
expect(element.getAttribute('data-original-title')).toBe(dataOriginalTitle);
expect(element.getAttribute('title')).toBe(title);
});
});
import { shallowMount } from '@vue/test-utils';
import { GlModal } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants';
import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
describe('vue_shared/components/confirm_modal', () => {
const testModalProps = {
path: `${TEST_HOST}/1`,
method: 'delete',
modalAttributes: {
modalId: 'test-confirm-modal',
title: 'Are you sure?',
message: 'This will remove item 1',
okVariant: 'danger',
okTitle: 'Remove item',
},
};
const actionSpies = {
openModal: jest.fn(),
};
let wrapper;
const createComponent = (props = {}) => {
wrapper = shallowMount(ConfirmModal, {
propsData: {
...testModalProps,
...props,
},
methods: {
...actionSpies,
},
});
};
afterEach(() => {
wrapper.destroy();
});
const findModal = () => wrapper.find(GlModal);
describe('template', () => {
beforeEach(() => {
createComponent();
});
it('calls openModal on mount', () => {
expect(actionSpies.openModal).toHaveBeenCalled();
});
it('renders GlModal', () => {
expect(findModal().exists()).toBeTruthy();
});
});
describe('methods', () => {
beforeEach(() => {
createComponent();
});
describe('submitModal', () => {
beforeEach(() => {
wrapper.vm.$refs.form.requestSubmit = jest.fn();
});
it('calls requestSubmit', () => {
wrapper.vm.submitModal();
expect(wrapper.vm.$refs.form.requestSubmit).toHaveBeenCalled();
});
});
describe('dismiss', () => {
it('removes gl-modal', () => {
expect(findModal().exists()).toBeTruthy();
wrapper.vm.dismiss();
return wrapper.vm.$nextTick(() => {
expect(findModal().exists()).toBeFalsy();
});
});
});
});
});
Loading
@@ -13,6 +13,7 @@ describe Gitlab::ProjectTemplate do
Loading
@@ -13,6 +13,7 @@ describe Gitlab::ProjectTemplate do
described_class.new('dotnetcore', '.NET Core', 'A .NET Core console application template, customizable for any .NET Core project', 'https://gitlab.com/gitlab-org/project-templates/dotnetcore'), described_class.new('dotnetcore', '.NET Core', 'A .NET Core console application template, customizable for any .NET Core project', 'https://gitlab.com/gitlab-org/project-templates/dotnetcore'),
described_class.new('android', 'Android', 'A ready-to-go template for use with Android apps.', 'https://gitlab.com/gitlab-org/project-templates/android'), described_class.new('android', 'Android', 'A ready-to-go template for use with Android apps.', 'https://gitlab.com/gitlab-org/project-templates/android'),
described_class.new('gomicro', 'Go Micro', 'Go Micro is a framework for micro service development.', 'https://gitlab.com/gitlab-org/project-templates/go-micro'), described_class.new('gomicro', 'Go Micro', 'Go Micro is a framework for micro service development.', 'https://gitlab.com/gitlab-org/project-templates/go-micro'),
described_class.new('gatsby', 'Pages/Gatsby', 'Everything you need to get started using a Gatsby site.', 'https://gitlab.com/pages/gatsby'),
described_class.new('hugo', 'Pages/Hugo', 'Everything you need to get started using a Hugo Pages site.', 'https://gitlab.com/pages/hugo'), described_class.new('hugo', 'Pages/Hugo', 'Everything you need to get started using a Hugo Pages site.', 'https://gitlab.com/pages/hugo'),
described_class.new('jekyll', 'Pages/Jekyll', 'Everything you need to get started using a Jekyll Pages site.', 'https://gitlab.com/pages/jekyll'), described_class.new('jekyll', 'Pages/Jekyll', 'Everything you need to get started using a Jekyll Pages site.', 'https://gitlab.com/pages/jekyll'),
described_class.new('plainhtml', 'Pages/Plain HTML', 'Everything you need to get started using a plain HTML Pages site.', 'https://gitlab.com/pages/plain-html'), described_class.new('plainhtml', 'Pages/Plain HTML', 'Everything you need to get started using a plain HTML Pages site.', 'https://gitlab.com/pages/plain-html'),
Loading
Loading
Loading
@@ -58,7 +58,7 @@ describe 'GraphQL' do
Loading
@@ -58,7 +58,7 @@ describe 'GraphQL' do
it 'returns an error' do it 'returns an error' do
post_graphql(query, variables: "This is not JSON") post_graphql(query, variables: "This is not JSON")
   
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['errors'].first['message']).not_to be_nil expect(json_response['errors'].first['message']).not_to be_nil
end end
end end
Loading
@@ -114,7 +114,7 @@ describe 'GraphQL' do
Loading
@@ -114,7 +114,7 @@ describe 'GraphQL' do
   
post_graphql(query, headers: { 'PRIVATE-TOKEN' => token.token }) post_graphql(query, headers: { 'PRIVATE-TOKEN' => token.token })
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
   
expect(graphql_data['echo']).to eq('nil says: Hello world') expect(graphql_data['echo']).to eq('nil says: Hello world')
end end
Loading
Loading
Loading
@@ -50,7 +50,7 @@ describe API::GroupBoards do
Loading
@@ -50,7 +50,7 @@ describe API::GroupBoards do
   
post api(url, user), params: { label_id: project_label.id } post api(url, user), params: { label_id: project_label.id }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
Loading
@@ -26,7 +26,7 @@ describe API::GroupClusters do
Loading
@@ -26,7 +26,7 @@ describe API::GroupClusters do
it 'responds with 403' do it 'responds with 403' do
get api("/groups/#{group.id}/clusters", developer_user) get api("/groups/#{group.id}/clusters", developer_user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -36,7 +36,7 @@ describe API::GroupClusters do
Loading
@@ -36,7 +36,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 200' do it 'responds with 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
   
it 'includes pagination headers' do it 'includes pagination headers' do
Loading
@@ -70,7 +70,7 @@ describe API::GroupClusters do
Loading
@@ -70,7 +70,7 @@ describe API::GroupClusters do
it 'responds with 403' do it 'responds with 403' do
get api("/groups/#{group.id}/clusters/#{cluster_id}", developer_user) get api("/groups/#{group.id}/clusters/#{cluster_id}", developer_user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -140,7 +140,7 @@ describe API::GroupClusters do
Loading
@@ -140,7 +140,7 @@ describe API::GroupClusters do
let(:cluster_id) { 123 } let(:cluster_id) { 123 }
   
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -179,7 +179,7 @@ describe API::GroupClusters do
Loading
@@ -179,7 +179,7 @@ describe API::GroupClusters do
it 'responds with 403' do it 'responds with 403' do
post api("/groups/#{group.id}/clusters/user", developer_user), params: cluster_params post api("/groups/#{group.id}/clusters/user", developer_user), params: cluster_params
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -190,7 +190,7 @@ describe API::GroupClusters do
Loading
@@ -190,7 +190,7 @@ describe API::GroupClusters do
   
context 'with valid params' do context 'with valid params' do
it 'responds with 201' do it 'responds with 201' do
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
   
it 'creates a new Cluster::Cluster' do it 'creates a new Cluster::Cluster' do
Loading
@@ -238,7 +238,7 @@ describe API::GroupClusters do
Loading
@@ -238,7 +238,7 @@ describe API::GroupClusters do
let(:api_url) { 'invalid_api_url' } let(:api_url) { 'invalid_api_url' }
   
it 'responds with 400' do it 'responds with 400' do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'does not create a new Clusters::Cluster' do it 'does not create a new Clusters::Cluster' do
Loading
@@ -260,7 +260,7 @@ describe API::GroupClusters do
Loading
@@ -260,7 +260,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 400' do it 'responds with 400' do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['base'].first).to eq(_('Instance does not support multiple Kubernetes clusters')) expect(json_response['message']['base'].first).to eq(_('Instance does not support multiple Kubernetes clusters'))
end end
end end
Loading
@@ -271,7 +271,7 @@ describe API::GroupClusters do
Loading
@@ -271,7 +271,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 403' do it 'responds with 403' do
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
   
expect(json_response['message']).to eq('403 Forbidden') expect(json_response['message']).to eq('403 Forbidden')
end end
Loading
@@ -305,7 +305,7 @@ describe API::GroupClusters do
Loading
@@ -305,7 +305,7 @@ describe API::GroupClusters do
it 'responds with 403' do it 'responds with 403' do
put api("/groups/#{group.id}/clusters/#{cluster.id}", developer_user), params: update_params put api("/groups/#{group.id}/clusters/#{cluster.id}", developer_user), params: update_params
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -320,7 +320,7 @@ describe API::GroupClusters do
Loading
@@ -320,7 +320,7 @@ describe API::GroupClusters do
   
context 'with valid params' do context 'with valid params' do
it 'responds with 200' do it 'responds with 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
   
it 'updates cluster attributes' do it 'updates cluster attributes' do
Loading
@@ -333,7 +333,7 @@ describe API::GroupClusters do
Loading
@@ -333,7 +333,7 @@ describe API::GroupClusters do
let(:domain) { 'invalid domain' } let(:domain) { 'invalid domain' }
   
it 'responds with 400' do it 'responds with 400' do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'does not update cluster attributes' do it 'does not update cluster attributes' do
Loading
@@ -350,7 +350,7 @@ describe API::GroupClusters do
Loading
@@ -350,7 +350,7 @@ describe API::GroupClusters do
let(:management_project_id) { create(:project).id } let(:management_project_id) { create(:project).id }
   
it 'responds with 400' do it 'responds with 400' do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'returns validation errors' do it 'returns validation errors' do
Loading
@@ -368,7 +368,7 @@ describe API::GroupClusters do
Loading
@@ -368,7 +368,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 400' do it 'responds with 400' do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'returns validation error' do it 'returns validation error' do
Loading
@@ -380,7 +380,7 @@ describe API::GroupClusters do
Loading
@@ -380,7 +380,7 @@ describe API::GroupClusters do
let(:domain) { 'new-domain.com' } let(:domain) { 'new-domain.com' }
   
it 'responds with 200' do it 'responds with 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
Loading
@@ -408,7 +408,7 @@ describe API::GroupClusters do
Loading
@@ -408,7 +408,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 200' do it 'responds with 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
   
it 'updates platform kubernetes attributes' do it 'updates platform kubernetes attributes' do
Loading
@@ -424,7 +424,7 @@ describe API::GroupClusters do
Loading
@@ -424,7 +424,7 @@ describe API::GroupClusters do
let(:cluster) { create(:cluster, :group, :provided_by_user) } let(:cluster) { create(:cluster, :group, :provided_by_user) }
   
it 'responds with 404' do it 'responds with 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -442,7 +442,7 @@ describe API::GroupClusters do
Loading
@@ -442,7 +442,7 @@ describe API::GroupClusters do
it 'responds with 403' do it 'responds with 403' do
delete api("/groups/#{group.id}/clusters/#{cluster.id}", developer_user), params: cluster_params delete api("/groups/#{group.id}/clusters/#{cluster.id}", developer_user), params: cluster_params
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -452,7 +452,7 @@ describe API::GroupClusters do
Loading
@@ -452,7 +452,7 @@ describe API::GroupClusters do
end end
   
it 'responds with 204' do it 'responds with 204' do
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
   
it 'deletes the cluster' do it 'deletes the cluster' do
Loading
@@ -463,7 +463,7 @@ describe API::GroupClusters do
Loading
@@ -463,7 +463,7 @@ describe API::GroupClusters do
let(:cluster) { create(:cluster, :group, :provided_by_user) } let(:cluster) { create(:cluster, :group, :provided_by_user) }
   
it 'responds with 404' do it 'responds with 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
Loading
Loading
@@ -44,7 +44,7 @@ describe API::GroupExport do
Loading
@@ -44,7 +44,7 @@ describe API::GroupExport do
it 'downloads exported group archive' do it 'downloads exported group archive' do
get api(download_path, user) get api(download_path, user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
   
context 'when export_file.file does not exist' do context 'when export_file.file does not exist' do
Loading
@@ -57,7 +57,7 @@ describe API::GroupExport do
Loading
@@ -57,7 +57,7 @@ describe API::GroupExport do
it 'returns 404' do it 'returns 404' do
get api(download_path, user) get api(download_path, user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -66,7 +66,7 @@ describe API::GroupExport do
Loading
@@ -66,7 +66,7 @@ describe API::GroupExport do
it 'returns 404' do it 'returns 404' do
get api(download_path, user) get api(download_path, user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -79,7 +79,7 @@ describe API::GroupExport do
Loading
@@ -79,7 +79,7 @@ describe API::GroupExport do
it 'responds with 404 Not Found' do it 'responds with 404 Not Found' do
get api(download_path, user) get api(download_path, user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -98,7 +98,7 @@ describe API::GroupExport do
Loading
@@ -98,7 +98,7 @@ describe API::GroupExport do
it 'accepts download' do it 'accepts download' do
post api(path, user) post api(path, user)
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
end end
end end
   
Loading
@@ -110,7 +110,7 @@ describe API::GroupExport do
Loading
@@ -110,7 +110,7 @@ describe API::GroupExport do
it 'forbids the request' do it 'forbids the request' do
post api(path, user) post api(path, user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
Loading
@@ -123,7 +123,7 @@ describe API::GroupExport do
Loading
@@ -123,7 +123,7 @@ describe API::GroupExport do
it 'responds with 404 Not Found' do it 'responds with 404 Not Found' do
post api(path, user) post api(path, user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
Loading
Loading
@@ -42,7 +42,7 @@ describe API::GroupImport do
Loading
@@ -42,7 +42,7 @@ describe API::GroupImport do
it 'creates new group and accepts request' do it 'creates new group and accepts request' do
subject subject
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
end end
   
it 'creates private group' do it 'creates private group' do
Loading
@@ -63,7 +63,7 @@ describe API::GroupImport do
Loading
@@ -63,7 +63,7 @@ describe API::GroupImport do
   
subject subject
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
expect(group.children.count).to eq(1) expect(group.children.count).to eq(1)
end end
   
Loading
@@ -81,7 +81,7 @@ describe API::GroupImport do
Loading
@@ -81,7 +81,7 @@ describe API::GroupImport do
   
subject subject
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
expect(public_parent_group.children.first.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC) expect(public_parent_group.children.first.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC)
end end
   
Loading
@@ -90,7 +90,7 @@ describe API::GroupImport do
Loading
@@ -90,7 +90,7 @@ describe API::GroupImport do
   
subject subject
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
expect(internal_parent_group.children.first.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL) expect(internal_parent_group.children.first.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL)
end end
end end
Loading
@@ -101,7 +101,7 @@ describe API::GroupImport do
Loading
@@ -101,7 +101,7 @@ describe API::GroupImport do
   
expect { subject }.not_to change { Group.count } expect { subject }.not_to change { Group.count }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Group Not Found') expect(json_response['message']).to eq('404 Group Not Found')
end end
   
Loading
@@ -111,7 +111,7 @@ describe API::GroupImport do
Loading
@@ -111,7 +111,7 @@ describe API::GroupImport do
   
subject subject
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['message']).to eq('403 Forbidden') expect(json_response['message']).to eq('403 Forbidden')
end end
end end
Loading
@@ -128,7 +128,7 @@ describe API::GroupImport do
Loading
@@ -128,7 +128,7 @@ describe API::GroupImport do
it 'returns 400 HTTP status' do it 'returns 400 HTTP status' do
subject subject
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
Loading
@@ -139,7 +139,7 @@ describe API::GroupImport do
Loading
@@ -139,7 +139,7 @@ describe API::GroupImport do
it 'forbids the request' do it 'forbids the request' do
subject subject
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
Loading
@@ -154,7 +154,7 @@ describe API::GroupImport do
Loading
@@ -154,7 +154,7 @@ describe API::GroupImport do
post api('/groups/import', user), params: params, headers: workhorse_header post api('/groups/import', user), params: params, headers: workhorse_header
end.not_to change { Group.count }.from(1) end.not_to change { Group.count }.from(1)
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq(error_message) expect(json_response['error']).to eq(error_message)
end end
end end
Loading
Loading
Loading
@@ -15,7 +15,7 @@ describe API::GroupLabels do
Loading
@@ -15,7 +15,7 @@ describe API::GroupLabels do
it 'returns all available labels for the group' do it 'returns all available labels for the group' do
get api("/groups/#{group.id}/labels", user) get api("/groups/#{group.id}/labels", user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label')) expect(json_response).to all(match_schema('public_api/v4/labels/label'))
Loading
@@ -27,7 +27,7 @@ describe API::GroupLabels do
Loading
@@ -27,7 +27,7 @@ describe API::GroupLabels do
it 'includes counts in the response' do it 'includes counts in the response' do
get api("/groups/#{group.id}/labels", user), params: { with_counts: true } get api("/groups/#{group.id}/labels", user), params: { with_counts: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label_with_counts')) expect(json_response).to all(match_schema('public_api/v4/labels/label_with_counts'))
Loading
@@ -42,7 +42,7 @@ describe API::GroupLabels do
Loading
@@ -42,7 +42,7 @@ describe API::GroupLabels do
it 'returns all available labels for the group and ancestor groups' do it 'returns all available labels for the group and ancestor groups' do
get api("/groups/#{subgroup.id}/labels", user) get api("/groups/#{subgroup.id}/labels", user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label')) expect(json_response).to all(match_schema('public_api/v4/labels/label'))
Loading
@@ -55,7 +55,7 @@ describe API::GroupLabels do
Loading
@@ -55,7 +55,7 @@ describe API::GroupLabels do
it 'returns all available labels for the group but not for ancestor groups' do it 'returns all available labels for the group but not for ancestor groups' do
get api("/groups/#{subgroup.id}/labels", user), params: { include_ancestor_groups: false } get api("/groups/#{subgroup.id}/labels", user), params: { include_ancestor_groups: false }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label')) expect(json_response).to all(match_schema('public_api/v4/labels/label'))
Loading
@@ -69,7 +69,7 @@ describe API::GroupLabels do
Loading
@@ -69,7 +69,7 @@ describe API::GroupLabels do
it 'returns a single label for the group' do it 'returns a single label for the group' do
get api("/groups/#{group.id}/labels/#{group_label1.name}", user) get api("/groups/#{group.id}/labels/#{group_label1.name}", user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(group_label1.name) expect(json_response['name']).to eq(group_label1.name)
expect(json_response['color']).to eq(group_label1.color) expect(json_response['color']).to eq(group_label1.color)
expect(json_response['description']).to eq(group_label1.description) expect(json_response['description']).to eq(group_label1.description)
Loading
@@ -85,7 +85,7 @@ describe API::GroupLabels do
Loading
@@ -85,7 +85,7 @@ describe API::GroupLabels do
description: 'test' description: 'test'
} }
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq('Foo') expect(json_response['name']).to eq('Foo')
expect(json_response['color']).to eq('#FFAABB') expect(json_response['color']).to eq('#FFAABB')
expect(json_response['description']).to eq('test') expect(json_response['description']).to eq('test')
Loading
@@ -107,13 +107,13 @@ describe API::GroupLabels do
Loading
@@ -107,13 +107,13 @@ describe API::GroupLabels do
it 'returns a 400 bad request if name not given' do it 'returns a 400 bad request if name not given' do
post api("/groups/#{group.id}/labels", user), params: { color: '#FFAABB' } post api("/groups/#{group.id}/labels", user), params: { color: '#FFAABB' }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'returns a 400 bad request if color is not given' do it 'returns a 400 bad request if color is not given' do
post api("/groups/#{group.id}/labels", user), params: { name: 'Foobar' } post api("/groups/#{group.id}/labels", user), params: { name: 'Foobar' }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it 'returns 409 if label already exists' do it 'returns 409 if label already exists' do
Loading
@@ -123,7 +123,7 @@ describe API::GroupLabels do
Loading
@@ -123,7 +123,7 @@ describe API::GroupLabels do
color: '#FFAABB' color: '#FFAABB'
} }
   
expect(response).to have_gitlab_http_status(409) expect(response).to have_gitlab_http_status(:conflict)
expect(json_response['message']).to eq('Label already exists') expect(json_response['message']).to eq('Label already exists')
end end
end end
Loading
@@ -132,20 +132,20 @@ describe API::GroupLabels do
Loading
@@ -132,20 +132,20 @@ describe API::GroupLabels do
it 'returns 204 for existing label' do it 'returns 204 for existing label' do
delete api("/groups/#{group.id}/labels", user), params: { name: group_label1.name } delete api("/groups/#{group.id}/labels", user), params: { name: group_label1.name }
   
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
   
it 'returns 404 for non existing label' do it 'returns 404 for non existing label' do
delete api("/groups/#{group.id}/labels", user), params: { name: 'not_exists' } delete api("/groups/#{group.id}/labels", user), params: { name: 'not_exists' }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Label Not Found') expect(json_response['message']).to eq('404 Label Not Found')
end end
   
it 'returns 400 for wrong parameters' do it 'returns 400 for wrong parameters' do
delete api("/groups/#{group.id}/labels", user) delete api("/groups/#{group.id}/labels", user)
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it "does not delete parent's group labels" do it "does not delete parent's group labels" do
Loading
@@ -154,7 +154,7 @@ describe API::GroupLabels do
Loading
@@ -154,7 +154,7 @@ describe API::GroupLabels do
   
delete api("/groups/#{subgroup.id}/labels", user), params: { name: subgroup_label.name } delete api("/groups/#{subgroup.id}/labels", user), params: { name: subgroup_label.name }
   
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(subgroup.labels.size).to eq(0) expect(subgroup.labels.size).to eq(0)
expect(group.labels).to include(group_label1) expect(group.labels).to include(group_label1)
end end
Loading
@@ -169,13 +169,13 @@ describe API::GroupLabels do
Loading
@@ -169,13 +169,13 @@ describe API::GroupLabels do
it 'returns 204 for existing label' do it 'returns 204 for existing label' do
delete api("/groups/#{group.id}/labels/#{group_label1.name}", user) delete api("/groups/#{group.id}/labels/#{group_label1.name}", user)
   
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
   
it 'returns 404 for non existing label' do it 'returns 404 for non existing label' do
delete api("/groups/#{group.id}/labels/not_exists", user) delete api("/groups/#{group.id}/labels/not_exists", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Label Not Found') expect(json_response['message']).to eq('404 Label Not Found')
end end
   
Loading
@@ -185,7 +185,7 @@ describe API::GroupLabels do
Loading
@@ -185,7 +185,7 @@ describe API::GroupLabels do
   
delete api("/groups/#{subgroup.id}/labels/#{subgroup_label.name}", user) delete api("/groups/#{subgroup.id}/labels/#{subgroup_label.name}", user)
   
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(subgroup.labels.size).to eq(0) expect(subgroup.labels.size).to eq(0)
expect(group.labels).to include(group_label1) expect(group.labels).to include(group_label1)
end end
Loading
@@ -205,7 +205,7 @@ describe API::GroupLabels do
Loading
@@ -205,7 +205,7 @@ describe API::GroupLabels do
description: 'test' description: 'test'
} }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq('New Label') expect(json_response['name']).to eq('New Label')
expect(json_response['color']).to eq('#FFFFFF') expect(json_response['color']).to eq('#FFFFFF')
expect(json_response['description']).to eq('test') expect(json_response['description']).to eq('test')
Loading
@@ -221,7 +221,7 @@ describe API::GroupLabels do
Loading
@@ -221,7 +221,7 @@ describe API::GroupLabels do
new_name: 'New Label' new_name: 'New Label'
} }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(subgroup.labels[0].name).to eq('New Label') expect(subgroup.labels[0].name).to eq('New Label')
expect(group_label1.name).to eq('feature') expect(group_label1.name).to eq('feature')
end end
Loading
@@ -233,20 +233,20 @@ describe API::GroupLabels do
Loading
@@ -233,20 +233,20 @@ describe API::GroupLabels do
new_name: 'label3' new_name: 'label3'
} }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'returns 400 if no label name given' do it 'returns 400 if no label name given' do
put api("/groups/#{group.id}/labels", user), params: { new_name: group_label1.name } put api("/groups/#{group.id}/labels", user), params: { new_name: group_label1.name }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('label_id, name are missing, exactly one parameter must be provided') expect(json_response['error']).to eq('label_id, name are missing, exactly one parameter must be provided')
end end
   
it 'returns 400 if no new parameters given' do it 'returns 400 if no new parameters given' do
put api("/groups/#{group.id}/labels", user), params: { name: group_label1.name } put api("/groups/#{group.id}/labels", user), params: { name: group_label1.name }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('new_name, color, description are missing, '\ expect(json_response['error']).to eq('new_name, color, description are missing, '\
'at least one parameter must be provided') 'at least one parameter must be provided')
end end
Loading
@@ -261,7 +261,7 @@ describe API::GroupLabels do
Loading
@@ -261,7 +261,7 @@ describe API::GroupLabels do
description: 'test' description: 'test'
} }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq('New Label') expect(json_response['name']).to eq('New Label')
expect(json_response['color']).to eq('#FFFFFF') expect(json_response['color']).to eq('#FFFFFF')
expect(json_response['description']).to eq('test') expect(json_response['description']).to eq('test')
Loading
@@ -276,7 +276,7 @@ describe API::GroupLabels do
Loading
@@ -276,7 +276,7 @@ describe API::GroupLabels do
new_name: 'New Label' new_name: 'New Label'
} }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(subgroup.labels[0].name).to eq('New Label') expect(subgroup.labels[0].name).to eq('New Label')
expect(group_label1.name).to eq('feature') expect(group_label1.name).to eq('feature')
end end
Loading
@@ -287,13 +287,13 @@ describe API::GroupLabels do
Loading
@@ -287,13 +287,13 @@ describe API::GroupLabels do
new_name: 'label3' new_name: 'label3'
} }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'returns 400 if no new parameters given' do it 'returns 400 if no new parameters given' do
put api("/groups/#{group.id}/labels/#{group_label1.name}", user) put api("/groups/#{group.id}/labels/#{group_label1.name}", user)
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('new_name, color, description are missing, '\ expect(json_response['error']).to eq('new_name, color, description are missing, '\
'at least one parameter must be provided') 'at least one parameter must be provided')
end end
Loading
@@ -304,7 +304,7 @@ describe API::GroupLabels do
Loading
@@ -304,7 +304,7 @@ describe API::GroupLabels do
it 'subscribes to the label' do it 'subscribes to the label' do
post api("/groups/#{group.id}/labels/#{group_label1.title}/subscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.title}/subscribe", user)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq(group_label1.title) expect(json_response['name']).to eq(group_label1.title)
expect(json_response['subscribed']).to be_truthy expect(json_response['subscribed']).to be_truthy
end end
Loading
@@ -314,7 +314,7 @@ describe API::GroupLabels do
Loading
@@ -314,7 +314,7 @@ describe API::GroupLabels do
it 'subscribes to the label' do it 'subscribes to the label' do
post api("/groups/#{group.id}/labels/#{group_label1.id}/subscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.id}/subscribe", user)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq(group_label1.title) expect(json_response['name']).to eq(group_label1.title)
expect(json_response['subscribed']).to be_truthy expect(json_response['subscribed']).to be_truthy
end end
Loading
@@ -328,7 +328,7 @@ describe API::GroupLabels do
Loading
@@ -328,7 +328,7 @@ describe API::GroupLabels do
it 'returns 304' do it 'returns 304' do
post api("/groups/#{group.id}/labels/#{group_label1.id}/subscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.id}/subscribe", user)
   
expect(response).to have_gitlab_http_status(304) expect(response).to have_gitlab_http_status(:not_modified)
end end
end end
   
Loading
@@ -336,7 +336,7 @@ describe API::GroupLabels do
Loading
@@ -336,7 +336,7 @@ describe API::GroupLabels do
it 'returns 404 error' do it 'returns 404 error' do
post api("/groups/#{group.id}/labels/1234/subscribe", user) post api("/groups/#{group.id}/labels/1234/subscribe", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -350,7 +350,7 @@ describe API::GroupLabels do
Loading
@@ -350,7 +350,7 @@ describe API::GroupLabels do
it 'unsubscribes from the label' do it 'unsubscribes from the label' do
post api("/groups/#{group.id}/labels/#{group_label1.title}/unsubscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.title}/unsubscribe", user)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq(group_label1.title) expect(json_response['name']).to eq(group_label1.title)
expect(json_response['subscribed']).to be_falsey expect(json_response['subscribed']).to be_falsey
end end
Loading
@@ -360,7 +360,7 @@ describe API::GroupLabels do
Loading
@@ -360,7 +360,7 @@ describe API::GroupLabels do
it 'unsubscribes from the label' do it 'unsubscribes from the label' do
post api("/groups/#{group.id}/labels/#{group_label1.id}/unsubscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.id}/unsubscribe", user)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq(group_label1.title) expect(json_response['name']).to eq(group_label1.title)
expect(json_response['subscribed']).to be_falsey expect(json_response['subscribed']).to be_falsey
end end
Loading
@@ -374,7 +374,7 @@ describe API::GroupLabels do
Loading
@@ -374,7 +374,7 @@ describe API::GroupLabels do
it 'returns 304' do it 'returns 304' do
post api("/groups/#{group.id}/labels/#{group_label1.id}/unsubscribe", user) post api("/groups/#{group.id}/labels/#{group_label1.id}/unsubscribe", user)
   
expect(response).to have_gitlab_http_status(304) expect(response).to have_gitlab_http_status(:not_modified)
end end
end end
   
Loading
@@ -382,7 +382,7 @@ describe API::GroupLabels do
Loading
@@ -382,7 +382,7 @@ describe API::GroupLabels do
it 'returns 404 error' do it 'returns 404 error' do
post api("/groups/#{group.id}/labels/1234/unsubscribe", user) post api("/groups/#{group.id}/labels/1234/unsubscribe", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
Loading
Loading
@@ -17,7 +17,7 @@ describe API::GroupVariables do
Loading
@@ -17,7 +17,7 @@ describe API::GroupVariables do
it 'returns group variables' do it 'returns group variables' do
get api("/groups/#{group.id}/variables", user) get api("/groups/#{group.id}/variables", user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_a(Array) expect(json_response).to be_a(Array)
end end
end end
Loading
@@ -26,7 +26,7 @@ describe API::GroupVariables do
Loading
@@ -26,7 +26,7 @@ describe API::GroupVariables do
it 'does not return group variables' do it 'does not return group variables' do
get api("/groups/#{group.id}/variables", user) get api("/groups/#{group.id}/variables", user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -34,7 +34,7 @@ describe API::GroupVariables do
Loading
@@ -34,7 +34,7 @@ describe API::GroupVariables do
it 'does not return group variables' do it 'does not return group variables' do
get api("/groups/#{group.id}/variables") get api("/groups/#{group.id}/variables")
   
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
Loading
@@ -50,7 +50,7 @@ describe API::GroupVariables do
Loading
@@ -50,7 +50,7 @@ describe API::GroupVariables do
it 'returns group variable details' do it 'returns group variable details' do
get api("/groups/#{group.id}/variables/#{variable.key}", user) get api("/groups/#{group.id}/variables/#{variable.key}", user)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['value']).to eq(variable.value) expect(json_response['value']).to eq(variable.value)
expect(json_response['protected']).to eq(variable.protected?) expect(json_response['protected']).to eq(variable.protected?)
expect(json_response['variable_type']).to eq(variable.variable_type) expect(json_response['variable_type']).to eq(variable.variable_type)
Loading
@@ -59,7 +59,7 @@ describe API::GroupVariables do
Loading
@@ -59,7 +59,7 @@ describe API::GroupVariables do
it 'responds with 404 Not Found if requesting non-existing variable' do it 'responds with 404 Not Found if requesting non-existing variable' do
get api("/groups/#{group.id}/variables/non_existing_variable", user) get api("/groups/#{group.id}/variables/non_existing_variable", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -67,7 +67,7 @@ describe API::GroupVariables do
Loading
@@ -67,7 +67,7 @@ describe API::GroupVariables do
it 'does not return group variable details' do it 'does not return group variable details' do
get api("/groups/#{group.id}/variables/#{variable.key}", user) get api("/groups/#{group.id}/variables/#{variable.key}", user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -75,7 +75,7 @@ describe API::GroupVariables do
Loading
@@ -75,7 +75,7 @@ describe API::GroupVariables do
it 'does not return group variable details' do it 'does not return group variable details' do
get api("/groups/#{group.id}/variables/#{variable.key}") get api("/groups/#{group.id}/variables/#{variable.key}")
   
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
Loading
@@ -93,7 +93,7 @@ describe API::GroupVariables do
Loading
@@ -93,7 +93,7 @@ describe API::GroupVariables do
post api("/groups/#{group.id}/variables", user), params: { key: 'TEST_VARIABLE_2', value: 'PROTECTED_VALUE_2', protected: true, masked: true } post api("/groups/#{group.id}/variables", user), params: { key: 'TEST_VARIABLE_2', value: 'PROTECTED_VALUE_2', protected: true, masked: true }
end.to change {group.variables.count}.by(1) end.to change {group.variables.count}.by(1)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['key']).to eq('TEST_VARIABLE_2') expect(json_response['key']).to eq('TEST_VARIABLE_2')
expect(json_response['value']).to eq('PROTECTED_VALUE_2') expect(json_response['value']).to eq('PROTECTED_VALUE_2')
expect(json_response['protected']).to be_truthy expect(json_response['protected']).to be_truthy
Loading
@@ -106,7 +106,7 @@ describe API::GroupVariables do
Loading
@@ -106,7 +106,7 @@ describe API::GroupVariables do
post api("/groups/#{group.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2' } post api("/groups/#{group.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2' }
end.to change {group.variables.count}.by(1) end.to change {group.variables.count}.by(1)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response['key']).to eq('TEST_VARIABLE_2') expect(json_response['key']).to eq('TEST_VARIABLE_2')
expect(json_response['value']).to eq('VALUE_2') expect(json_response['value']).to eq('VALUE_2')
expect(json_response['protected']).to be_falsey expect(json_response['protected']).to be_falsey
Loading
@@ -119,7 +119,7 @@ describe API::GroupVariables do
Loading
@@ -119,7 +119,7 @@ describe API::GroupVariables do
post api("/groups/#{group.id}/variables", user), params: { key: variable.key, value: 'VALUE_2' } post api("/groups/#{group.id}/variables", user), params: { key: variable.key, value: 'VALUE_2' }
end.to change {group.variables.count}.by(0) end.to change {group.variables.count}.by(0)
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
   
Loading
@@ -127,7 +127,7 @@ describe API::GroupVariables do
Loading
@@ -127,7 +127,7 @@ describe API::GroupVariables do
it 'does not create variable' do it 'does not create variable' do
post api("/groups/#{group.id}/variables", user) post api("/groups/#{group.id}/variables", user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -135,7 +135,7 @@ describe API::GroupVariables do
Loading
@@ -135,7 +135,7 @@ describe API::GroupVariables do
it 'does not create variable' do it 'does not create variable' do
post api("/groups/#{group.id}/variables") post api("/groups/#{group.id}/variables")
   
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
Loading
@@ -156,7 +156,7 @@ describe API::GroupVariables do
Loading
@@ -156,7 +156,7 @@ describe API::GroupVariables do
   
updated_variable = group.variables.reload.first updated_variable = group.variables.reload.first
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(value_before).to eq(variable.value) expect(value_before).to eq(variable.value)
expect(updated_variable.value).to eq('VALUE_1_UP') expect(updated_variable.value).to eq('VALUE_1_UP')
expect(updated_variable).to be_protected expect(updated_variable).to be_protected
Loading
@@ -167,7 +167,7 @@ describe API::GroupVariables do
Loading
@@ -167,7 +167,7 @@ describe API::GroupVariables do
it 'responds with 404 Not Found if requesting non-existing variable' do it 'responds with 404 Not Found if requesting non-existing variable' do
put api("/groups/#{group.id}/variables/non_existing_variable", user) put api("/groups/#{group.id}/variables/non_existing_variable", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -175,7 +175,7 @@ describe API::GroupVariables do
Loading
@@ -175,7 +175,7 @@ describe API::GroupVariables do
it 'does not update variable' do it 'does not update variable' do
put api("/groups/#{group.id}/variables/#{variable.key}", user) put api("/groups/#{group.id}/variables/#{variable.key}", user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -183,7 +183,7 @@ describe API::GroupVariables do
Loading
@@ -183,7 +183,7 @@ describe API::GroupVariables do
it 'does not update variable' do it 'does not update variable' do
put api("/groups/#{group.id}/variables/#{variable.key}") put api("/groups/#{group.id}/variables/#{variable.key}")
   
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
Loading
@@ -200,14 +200,14 @@ describe API::GroupVariables do
Loading
@@ -200,14 +200,14 @@ describe API::GroupVariables do
expect do expect do
delete api("/groups/#{group.id}/variables/#{variable.key}", user) delete api("/groups/#{group.id}/variables/#{variable.key}", user)
   
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end.to change {group.variables.count}.by(-1) end.to change {group.variables.count}.by(-1)
end end
   
it 'responds with 404 Not Found if requesting non-existing variable' do it 'responds with 404 Not Found if requesting non-existing variable' do
delete api("/groups/#{group.id}/variables/non_existing_variable", user) delete api("/groups/#{group.id}/variables/non_existing_variable", user)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it_behaves_like '412 response' do it_behaves_like '412 response' do
Loading
@@ -219,7 +219,7 @@ describe API::GroupVariables do
Loading
@@ -219,7 +219,7 @@ describe API::GroupVariables do
it 'does not delete variable' do it 'does not delete variable' do
delete api("/groups/#{group.id}/variables/#{variable.key}", user) delete api("/groups/#{group.id}/variables/#{variable.key}", user)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -227,7 +227,7 @@ describe API::GroupVariables do
Loading
@@ -227,7 +227,7 @@ describe API::GroupVariables do
it 'does not delete variable' do it 'does not delete variable' do
delete api("/groups/#{group.id}/variables/#{variable.key}") delete api("/groups/#{group.id}/variables/#{variable.key}")
   
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
Loading
Loading
Loading
@@ -26,7 +26,7 @@ describe API::Groups do
Loading
@@ -26,7 +26,7 @@ describe API::Groups do
it "returns public groups" do it "returns public groups" do
get api("/groups") get api("/groups")
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -54,7 +54,7 @@ describe API::Groups do
Loading
@@ -54,7 +54,7 @@ describe API::Groups do
it "normal user: returns an array of groups of user1" do it "normal user: returns an array of groups of user1" do
get api("/groups", user1) get api("/groups", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -65,7 +65,7 @@ describe API::Groups do
Loading
@@ -65,7 +65,7 @@ describe API::Groups do
it "does not include runners_token information" do it "does not include runners_token information" do
get api("/groups", user1) get api("/groups", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -75,7 +75,7 @@ describe API::Groups do
Loading
@@ -75,7 +75,7 @@ describe API::Groups do
it "does not include statistics" do it "does not include statistics" do
get api("/groups", user1), params: { statistics: true } get api("/groups", user1), params: { statistics: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first).not_to include 'statistics' expect(json_response.first).not_to include 'statistics'
Loading
@@ -86,7 +86,7 @@ describe API::Groups do
Loading
@@ -86,7 +86,7 @@ describe API::Groups do
it "admin: returns an array of all groups" do it "admin: returns an array of all groups" do
get api("/groups", admin) get api("/groups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
Loading
@@ -95,7 +95,7 @@ describe API::Groups do
Loading
@@ -95,7 +95,7 @@ describe API::Groups do
it "does not include runners_token information" do it "does not include runners_token information" do
get api("/groups", admin) get api("/groups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
Loading
@@ -105,7 +105,7 @@ describe API::Groups do
Loading
@@ -105,7 +105,7 @@ describe API::Groups do
it "does not include statistics by default" do it "does not include statistics by default" do
get api("/groups", admin) get api("/groups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first).not_to include('statistics') expect(json_response.first).not_to include('statistics')
Loading
@@ -126,7 +126,7 @@ describe API::Groups do
Loading
@@ -126,7 +126,7 @@ describe API::Groups do
   
get api("/groups", admin), params: { statistics: true } get api("/groups", admin), params: { statistics: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response) expect(json_response)
Loading
@@ -138,7 +138,7 @@ describe API::Groups do
Loading
@@ -138,7 +138,7 @@ describe API::Groups do
it "returns all groups excluding skipped groups" do it "returns all groups excluding skipped groups" do
get api("/groups", admin), params: { skip_groups: [group2.id] } get api("/groups", admin), params: { skip_groups: [group2.id] }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -153,7 +153,7 @@ describe API::Groups do
Loading
@@ -153,7 +153,7 @@ describe API::Groups do
   
get api("/groups", user1), params: { all_available: true } get api("/groups", user1), params: { all_available: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to contain_exactly(public_group.name, group1.name) expect(response_groups).to contain_exactly(public_group.name, group1.name)
Loading
@@ -176,7 +176,7 @@ describe API::Groups do
Loading
@@ -176,7 +176,7 @@ describe API::Groups do
it "sorts by name ascending by default" do it "sorts by name ascending by default" do
get api("/groups", user1) get api("/groups", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq(groups_visible_to_user(user1).order(:name).pluck(:name)) expect(response_groups).to eq(groups_visible_to_user(user1).order(:name).pluck(:name))
Loading
@@ -185,7 +185,7 @@ describe API::Groups do
Loading
@@ -185,7 +185,7 @@ describe API::Groups do
it "sorts in descending order when passed" do it "sorts in descending order when passed" do
get api("/groups", user1), params: { sort: "desc" } get api("/groups", user1), params: { sort: "desc" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq(groups_visible_to_user(user1).order(name: :desc).pluck(:name)) expect(response_groups).to eq(groups_visible_to_user(user1).order(name: :desc).pluck(:name))
Loading
@@ -194,7 +194,7 @@ describe API::Groups do
Loading
@@ -194,7 +194,7 @@ describe API::Groups do
it "sorts by path in order_by param" do it "sorts by path in order_by param" do
get api("/groups", user1), params: { order_by: "path" } get api("/groups", user1), params: { order_by: "path" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq(groups_visible_to_user(user1).order(:path).pluck(:name)) expect(response_groups).to eq(groups_visible_to_user(user1).order(:path).pluck(:name))
Loading
@@ -203,7 +203,7 @@ describe API::Groups do
Loading
@@ -203,7 +203,7 @@ describe API::Groups do
it "sorts by id in the order_by param" do it "sorts by id in the order_by param" do
get api("/groups", user1), params: { order_by: "id" } get api("/groups", user1), params: { order_by: "id" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq(groups_visible_to_user(user1).order(:id).pluck(:name)) expect(response_groups).to eq(groups_visible_to_user(user1).order(:id).pluck(:name))
Loading
@@ -212,7 +212,7 @@ describe API::Groups do
Loading
@@ -212,7 +212,7 @@ describe API::Groups do
it "sorts also by descending id with pagination fix" do it "sorts also by descending id with pagination fix" do
get api("/groups", user1), params: { order_by: "id", sort: "desc" } get api("/groups", user1), params: { order_by: "id", sort: "desc" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq(groups_visible_to_user(user1).order(id: :desc).pluck(:name)) expect(response_groups).to eq(groups_visible_to_user(user1).order(id: :desc).pluck(:name))
Loading
@@ -221,7 +221,7 @@ describe API::Groups do
Loading
@@ -221,7 +221,7 @@ describe API::Groups do
it "sorts identical keys by id for good pagination" do it "sorts identical keys by id for good pagination" do
get api("/groups", user1), params: { search: "same-name", order_by: "name" } get api("/groups", user1), params: { search: "same-name", order_by: "name" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups_ids).to eq(Group.select { |group| group['name'] == 'same-name' }.map { |group| group['id'] }.sort) expect(response_groups_ids).to eq(Group.select { |group| group['name'] == 'same-name' }.map { |group| group['id'] }.sort)
Loading
@@ -230,7 +230,7 @@ describe API::Groups do
Loading
@@ -230,7 +230,7 @@ describe API::Groups do
it "sorts descending identical keys by id for good pagination" do it "sorts descending identical keys by id for good pagination" do
get api("/groups", user1), params: { search: "same-name", order_by: "name", sort: "desc" } get api("/groups", user1), params: { search: "same-name", order_by: "name", sort: "desc" }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups_ids).to eq(Group.select { |group| group['name'] == 'same-name' }.map { |group| group['id'] }.sort) expect(response_groups_ids).to eq(Group.select { |group| group['name'] == 'same-name' }.map { |group| group['id'] }.sort)
Loading
@@ -247,7 +247,7 @@ describe API::Groups do
Loading
@@ -247,7 +247,7 @@ describe API::Groups do
   
get api('/groups', user2), params: { owned: true } get api('/groups', user2), params: { owned: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -267,7 +267,7 @@ describe API::Groups do
Loading
@@ -267,7 +267,7 @@ describe API::Groups do
it 'returns an array of groups the user has at least master access' do it 'returns an array of groups the user has at least master access' do
get api('/groups', user2), params: { min_access_level: 40 } get api('/groups', user2), params: { min_access_level: 40 }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(response_groups).to eq([group2.id, group3.id]) expect(response_groups).to eq([group2.id, group3.id])
Loading
@@ -308,13 +308,13 @@ describe API::Groups do
Loading
@@ -308,13 +308,13 @@ describe API::Groups do
it 'returns 404 for a private group' do it 'returns 404 for a private group' do
get api("/groups/#{group2.id}") get api("/groups/#{group2.id}")
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'returns 200 for a public group' do it 'returns 200 for a public group' do
get api("/groups/#{group1.id}") get api("/groups/#{group1.id}")
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).not_to include('runners_token') expect(json_response).not_to include('runners_token')
end end
   
Loading
@@ -346,7 +346,7 @@ describe API::Groups do
Loading
@@ -346,7 +346,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}", user1) get api("/groups/#{group1.id}", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['id']).to eq(group1.id) expect(json_response['id']).to eq(group1.id)
expect(json_response['name']).to eq(group1.name) expect(json_response['name']).to eq(group1.name)
expect(json_response['path']).to eq(group1.path) expect(json_response['path']).to eq(group1.path)
Loading
@@ -379,7 +379,7 @@ describe API::Groups do
Loading
@@ -379,7 +379,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}", user1), params: { with_projects: false } get api("/groups/#{group1.id}", user1), params: { with_projects: false }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['projects']).to be_nil expect(json_response['projects']).to be_nil
expect(json_response['shared_projects']).to be_nil expect(json_response['shared_projects']).to be_nil
expect(json_response).not_to include('runners_token') expect(json_response).not_to include('runners_token')
Loading
@@ -388,7 +388,7 @@ describe API::Groups do
Loading
@@ -388,7 +388,7 @@ describe API::Groups do
it "doesn't return runners_token if the user is not the owner of the group" do it "doesn't return runners_token if the user is not the owner of the group" do
get api("/groups/#{group1.id}", user3) get api("/groups/#{group1.id}", user3)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).not_to include('runners_token') expect(json_response).not_to include('runners_token')
end end
   
Loading
@@ -396,20 +396,20 @@ describe API::Groups do
Loading
@@ -396,20 +396,20 @@ describe API::Groups do
group1.add_owner(user3) group1.add_owner(user3)
get api("/groups/#{group1.id}", user3) get api("/groups/#{group1.id}", user3)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to include('runners_token') expect(json_response).to include('runners_token')
end end
   
it "does not return a non existing group" do it "does not return a non existing group" do
get api("/groups/1328", user1) get api("/groups/1328", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it "does not return a group not attached to user1" do it "does not return a group not attached to user1" do
get api("/groups/#{group2.id}", user1) get api("/groups/#{group2.id}", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'returns only public and internal projects in the group' do it 'returns only public and internal projects in the group' do
Loading
@@ -451,21 +451,21 @@ describe API::Groups do
Loading
@@ -451,21 +451,21 @@ describe API::Groups do
it "returns any existing group" do it "returns any existing group" do
get api("/groups/#{group2.id}", admin) get api("/groups/#{group2.id}", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(group2.name) expect(json_response['name']).to eq(group2.name)
end end
   
it "returns information of the runners_token for the group" do it "returns information of the runners_token for the group" do
get api("/groups/#{group2.id}", admin) get api("/groups/#{group2.id}", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to include('runners_token') expect(json_response).to include('runners_token')
end end
   
it "does not return a non existing group" do it "does not return a non existing group" do
get api("/groups/1328", admin) get api("/groups/1328", admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -473,20 +473,20 @@ describe API::Groups do
Loading
@@ -473,20 +473,20 @@ describe API::Groups do
it 'returns any existing group' do it 'returns any existing group' do
get api("/groups/#{group1.path}", admin) get api("/groups/#{group1.path}", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(group1.name) expect(json_response['name']).to eq(group1.name)
end end
   
it 'does not return a non existing group' do it 'does not return a non existing group' do
get api('/groups/unknown', admin) get api('/groups/unknown', admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'does not return a group not attached to user1' do it 'does not return a group not attached to user1' do
get api("/groups/#{group2.path}", user1) get api("/groups/#{group2.path}", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -548,7 +548,7 @@ describe API::Groups do
Loading
@@ -548,7 +548,7 @@ describe API::Groups do
subgroup_creation_level: "maintainer" subgroup_creation_level: "maintainer"
} }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(new_group_name) expect(json_response['name']).to eq(new_group_name)
expect(json_response['description']).to eq('') expect(json_response['description']).to eq('')
expect(json_response['visibility']).to eq('public') expect(json_response['visibility']).to eq('public')
Loading
@@ -571,7 +571,7 @@ describe API::Groups do
Loading
@@ -571,7 +571,7 @@ describe API::Groups do
it 'returns 404 for a non existing group' do it 'returns 404 for a non existing group' do
put api('/groups/1328', user1), params: { name: new_group_name } put api('/groups/1328', user1), params: { name: new_group_name }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
context 'within a subgroup' do context 'within a subgroup' do
Loading
@@ -585,14 +585,14 @@ describe API::Groups do
Loading
@@ -585,14 +585,14 @@ describe API::Groups do
it 'does not change visibility when not requested' do it 'does not change visibility when not requested' do
put api("/groups/#{group3.id}", user3), params: { description: 'Bug #23083' } put api("/groups/#{group3.id}", user3), params: { description: 'Bug #23083' }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['visibility']).to eq('public') expect(json_response['visibility']).to eq('public')
end end
   
it 'prevents making private a group containing public subgroups' do it 'prevents making private a group containing public subgroups' do
put api("/groups/#{group3.id}", user3), params: { visibility: 'private' } put api("/groups/#{group3.id}", user3), params: { visibility: 'private' }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['visibility_level']).to contain_exactly('private is not allowed since there are sub-groups with higher visibility.') expect(json_response['message']['visibility_level']).to contain_exactly('private is not allowed since there are sub-groups with higher visibility.')
end end
end end
Loading
@@ -602,7 +602,7 @@ describe API::Groups do
Loading
@@ -602,7 +602,7 @@ describe API::Groups do
it 'updates the group' do it 'updates the group' do
put api("/groups/#{group1.id}", admin), params: { name: new_group_name } put api("/groups/#{group1.id}", admin), params: { name: new_group_name }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(new_group_name) expect(json_response['name']).to eq(new_group_name)
end end
end end
Loading
@@ -611,7 +611,7 @@ describe API::Groups do
Loading
@@ -611,7 +611,7 @@ describe API::Groups do
it 'does not updates the group' do it 'does not updates the group' do
put api("/groups/#{group1.id}", user2), params: { name: new_group_name } put api("/groups/#{group1.id}", user2), params: { name: new_group_name }
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -619,7 +619,7 @@ describe API::Groups do
Loading
@@ -619,7 +619,7 @@ describe API::Groups do
it 'returns 404 when trying to update the group' do it 'returns 404 when trying to update the group' do
put api("/groups/#{group2.id}", user1), params: { name: new_group_name } put api("/groups/#{group2.id}", user1), params: { name: new_group_name }
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -645,7 +645,7 @@ describe API::Groups do
Loading
@@ -645,7 +645,7 @@ describe API::Groups do
it "returns the group's projects" do it "returns the group's projects" do
get api("/groups/#{group1.id}/projects", user1) get api("/groups/#{group1.id}/projects", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
project_names = json_response.map { |proj| proj['name'] } project_names = json_response.map { |proj| proj['name'] }
Loading
@@ -656,7 +656,7 @@ describe API::Groups do
Loading
@@ -656,7 +656,7 @@ describe API::Groups do
it "returns the group's projects with simple representation" do it "returns the group's projects with simple representation" do
get api("/groups/#{group1.id}/projects", user1), params: { simple: true } get api("/groups/#{group1.id}/projects", user1), params: { simple: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
project_names = json_response.map { |proj| proj['name'] } project_names = json_response.map { |proj| proj['name'] }
Loading
@@ -669,7 +669,7 @@ describe API::Groups do
Loading
@@ -669,7 +669,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}/projects", user1), params: { visibility: 'public' } get api("/groups/#{group1.id}/projects", user1), params: { visibility: 'public' }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an(Array) expect(json_response).to be_an(Array)
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -683,7 +683,7 @@ describe API::Groups do
Loading
@@ -683,7 +683,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}/projects", user1), params: { with_shared: false } get api("/groups/#{group1.id}/projects", user1), params: { with_shared: false }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an(Array) expect(json_response).to be_an(Array)
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
Loading
@@ -696,7 +696,7 @@ describe API::Groups do
Loading
@@ -696,7 +696,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}/projects", user1), params: { include_subgroups: true } get api("/groups/#{group1.id}/projects", user1), params: { include_subgroups: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an(Array) expect(json_response).to be_an(Array)
expect(json_response.length).to eq(4) expect(json_response.length).to eq(4)
Loading
@@ -705,13 +705,13 @@ describe API::Groups do
Loading
@@ -705,13 +705,13 @@ describe API::Groups do
it "does not return a non existing group" do it "does not return a non existing group" do
get api("/groups/1328/projects", user1) get api("/groups/1328/projects", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it "does not return a group not attached to user1" do it "does not return a group not attached to user1" do
get api("/groups/#{group2.id}/projects", user1) get api("/groups/#{group2.id}/projects", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it "only returns projects to which user has access" do it "only returns projects to which user has access" do
Loading
@@ -719,7 +719,7 @@ describe API::Groups do
Loading
@@ -719,7 +719,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}/projects", user3) get api("/groups/#{group1.id}/projects", user3)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(project3.name) expect(json_response.first['name']).to eq(project3.name)
Loading
@@ -730,7 +730,7 @@ describe API::Groups do
Loading
@@ -730,7 +730,7 @@ describe API::Groups do
   
get api("/groups/#{project2.group.id}/projects", user3), params: { owned: true } get api("/groups/#{project2.group.id}/projects", user3), params: { owned: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(project2.name) expect(json_response.first['name']).to eq(project2.name)
end end
Loading
@@ -740,7 +740,7 @@ describe API::Groups do
Loading
@@ -740,7 +740,7 @@ describe API::Groups do
   
get api("/groups/#{group1.id}/projects", user1), params: { starred: true } get api("/groups/#{group1.id}/projects", user1), params: { starred: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(project1.name) expect(json_response.first['name']).to eq(project1.name)
end end
Loading
@@ -750,7 +750,7 @@ describe API::Groups do
Loading
@@ -750,7 +750,7 @@ describe API::Groups do
it "returns any existing group" do it "returns any existing group" do
get api("/groups/#{group2.id}/projects", admin) get api("/groups/#{group2.id}/projects", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(project2.name) expect(json_response.first['name']).to eq(project2.name)
Loading
@@ -759,7 +759,7 @@ describe API::Groups do
Loading
@@ -759,7 +759,7 @@ describe API::Groups do
it "does not return a non existing group" do it "does not return a non existing group" do
get api("/groups/1328/projects", admin) get api("/groups/1328/projects", admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'avoids N+1 queries' do it 'avoids N+1 queries' do
Loading
@@ -781,7 +781,7 @@ describe API::Groups do
Loading
@@ -781,7 +781,7 @@ describe API::Groups do
it 'returns any existing group' do it 'returns any existing group' do
get api("/groups/#{group1.path}/projects", admin) get api("/groups/#{group1.path}/projects", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
project_names = json_response.map { |proj| proj['name'] } project_names = json_response.map { |proj| proj['name'] }
expect(project_names).to match_array([project1.name, project3.name]) expect(project_names).to match_array([project1.name, project3.name])
Loading
@@ -790,13 +790,13 @@ describe API::Groups do
Loading
@@ -790,13 +790,13 @@ describe API::Groups do
it 'does not return a non existing group' do it 'does not return a non existing group' do
get api('/groups/unknown/projects', admin) get api('/groups/unknown/projects', admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it 'does not return a group not attached to user1' do it 'does not return a group not attached to user1' do
get api("/groups/#{group2.path}/projects", user1) get api("/groups/#{group2.path}/projects", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -810,7 +810,7 @@ describe API::Groups do
Loading
@@ -810,7 +810,7 @@ describe API::Groups do
it 'returns only public subgroups' do it 'returns only public subgroups' do
get api("/groups/#{group1.id}/subgroups") get api("/groups/#{group1.id}/subgroups")
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
Loading
@@ -821,7 +821,7 @@ describe API::Groups do
Loading
@@ -821,7 +821,7 @@ describe API::Groups do
it 'returns 404 for a private group' do it 'returns 404 for a private group' do
get api("/groups/#{group2.id}/subgroups") get api("/groups/#{group2.id}/subgroups")
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -830,7 +830,7 @@ describe API::Groups do
Loading
@@ -830,7 +830,7 @@ describe API::Groups do
it 'returns no subgroups for the public group' do it 'returns no subgroups for the public group' do
get api("/groups/#{group1.id}/subgroups", user2) get api("/groups/#{group1.id}/subgroups", user2)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(0) expect(json_response.length).to eq(0)
end end
Loading
@@ -839,7 +839,7 @@ describe API::Groups do
Loading
@@ -839,7 +839,7 @@ describe API::Groups do
it 'returns public subgroups' do it 'returns public subgroups' do
get api("/groups/#{group1.id}/subgroups", user2), params: { all_available: true } get api("/groups/#{group1.id}/subgroups", user2), params: { all_available: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response[0]['id']).to eq(subgroup1.id) expect(json_response[0]['id']).to eq(subgroup1.id)
Loading
@@ -852,7 +852,7 @@ describe API::Groups do
Loading
@@ -852,7 +852,7 @@ describe API::Groups do
it 'returns 404 for the private group' do it 'returns 404 for the private group' do
get api("/groups/#{group2.id}/subgroups", user1) get api("/groups/#{group2.id}/subgroups", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -864,7 +864,7 @@ describe API::Groups do
Loading
@@ -864,7 +864,7 @@ describe API::Groups do
it 'returns private subgroups' do it 'returns private subgroups' do
get api("/groups/#{group1.id}/subgroups", user2) get api("/groups/#{group1.id}/subgroups", user2)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
Loading
@@ -878,7 +878,7 @@ describe API::Groups do
Loading
@@ -878,7 +878,7 @@ describe API::Groups do
it 'does not include statistics' do it 'does not include statistics' do
get api("/groups/#{group1.id}/subgroups", user2), params: { statistics: true } get api("/groups/#{group1.id}/subgroups", user2), params: { statistics: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first).not_to include 'statistics' expect(json_response.first).not_to include 'statistics'
end end
Loading
@@ -893,7 +893,7 @@ describe API::Groups do
Loading
@@ -893,7 +893,7 @@ describe API::Groups do
it 'returns subgroups' do it 'returns subgroups' do
get api("/groups/#{group2.id}/subgroups", user1) get api("/groups/#{group2.id}/subgroups", user1)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
expect(json_response.first['id']).to eq(subgroup3.id) expect(json_response.first['id']).to eq(subgroup3.id)
Loading
@@ -906,7 +906,7 @@ describe API::Groups do
Loading
@@ -906,7 +906,7 @@ describe API::Groups do
it 'returns private subgroups of a public group' do it 'returns private subgroups of a public group' do
get api("/groups/#{group1.id}/subgroups", admin) get api("/groups/#{group1.id}/subgroups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
end end
Loading
@@ -914,7 +914,7 @@ describe API::Groups do
Loading
@@ -914,7 +914,7 @@ describe API::Groups do
it 'returns subgroups of a private group' do it 'returns subgroups of a private group' do
get api("/groups/#{group2.id}/subgroups", admin) get api("/groups/#{group2.id}/subgroups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(1) expect(json_response.length).to eq(1)
end end
Loading
@@ -922,7 +922,7 @@ describe API::Groups do
Loading
@@ -922,7 +922,7 @@ describe API::Groups do
it 'does not include statistics by default' do it 'does not include statistics by default' do
get api("/groups/#{group1.id}/subgroups", admin) get api("/groups/#{group1.id}/subgroups", admin)
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first).not_to include('statistics') expect(json_response.first).not_to include('statistics')
end end
Loading
@@ -930,7 +930,7 @@ describe API::Groups do
Loading
@@ -930,7 +930,7 @@ describe API::Groups do
it 'includes statistics if requested' do it 'includes statistics if requested' do
get api("/groups/#{group1.id}/subgroups", admin), params: { statistics: true } get api("/groups/#{group1.id}/subgroups", admin), params: { statistics: true }
   
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first).to include('statistics') expect(json_response.first).to include('statistics')
end end
Loading
@@ -944,7 +944,7 @@ describe API::Groups do
Loading
@@ -944,7 +944,7 @@ describe API::Groups do
   
post api("/groups", user1), params: group post api("/groups", user1), params: group
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
   
context 'as owner' do context 'as owner' do
Loading
@@ -955,7 +955,7 @@ describe API::Groups do
Loading
@@ -955,7 +955,7 @@ describe API::Groups do
it 'can create subgroups' do it 'can create subgroups' do
post api("/groups", user1), params: { parent_id: group2.id, name: 'foo', path: 'foo' } post api("/groups", user1), params: { parent_id: group2.id, name: 'foo', path: 'foo' }
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
end end
   
Loading
@@ -967,7 +967,7 @@ describe API::Groups do
Loading
@@ -967,7 +967,7 @@ describe API::Groups do
it 'can create subgroups' do it 'can create subgroups' do
post api("/groups", user1), params: { parent_id: group2.id, name: 'foo', path: 'foo' } post api("/groups", user1), params: { parent_id: group2.id, name: 'foo', path: 'foo' }
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
end end
end end
Loading
@@ -978,7 +978,7 @@ describe API::Groups do
Loading
@@ -978,7 +978,7 @@ describe API::Groups do
   
post api("/groups", user3), params: group post api("/groups", user3), params: group
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
   
expect(json_response["name"]).to eq(group[:name]) expect(json_response["name"]).to eq(group[:name])
expect(json_response["path"]).to eq(group[:path]) expect(json_response["path"]).to eq(group[:path])
Loading
@@ -993,7 +993,7 @@ describe API::Groups do
Loading
@@ -993,7 +993,7 @@ describe API::Groups do
   
post api("/groups", user3), params: group post api("/groups", user3), params: group
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
   
expect(json_response["full_path"]).to eq("#{parent.path}/#{group[:path]}") expect(json_response["full_path"]).to eq("#{parent.path}/#{group[:path]}")
expect(json_response["parent_id"]).to eq(parent.id) expect(json_response["parent_id"]).to eq(parent.id)
Loading
@@ -1002,20 +1002,20 @@ describe API::Groups do
Loading
@@ -1002,20 +1002,20 @@ describe API::Groups do
it "does not create group, duplicate" do it "does not create group, duplicate" do
post api("/groups", user3), params: { name: 'Duplicate Test', path: group2.path } post api("/groups", user3), params: { name: 'Duplicate Test', path: group2.path }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(response.message).to eq("Bad Request") expect(response.message).to eq("Bad Request")
end end
   
it "returns 400 bad request error if name not given" do it "returns 400 bad request error if name not given" do
post api("/groups", user3), params: { path: group2.path } post api("/groups", user3), params: { path: group2.path }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
   
it "returns 400 bad request error if path not given" do it "returns 400 bad request error if path not given" do
post api("/groups", user3), params: { name: 'test' } post api("/groups", user3), params: { name: 'test' }
   
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
Loading
@@ -1027,7 +1027,7 @@ describe API::Groups do
Loading
@@ -1027,7 +1027,7 @@ describe API::Groups do
expect { delete api("/groups/#{group1.id}", user1) }.to change(GroupDestroyWorker.jobs, :size).by(1) expect { delete api("/groups/#{group1.id}", user1) }.to change(GroupDestroyWorker.jobs, :size).by(1)
end end
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
end end
   
it_behaves_like '412 response' do it_behaves_like '412 response' do
Loading
@@ -1041,19 +1041,19 @@ describe API::Groups do
Loading
@@ -1041,19 +1041,19 @@ describe API::Groups do
   
delete api("/groups/#{group1.id}", user3) delete api("/groups/#{group1.id}", user3)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
   
it "does not remove a non existing group" do it "does not remove a non existing group" do
delete api("/groups/1328", user1) delete api("/groups/1328", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
   
it "does not remove a group not attached to user1" do it "does not remove a group not attached to user1" do
delete api("/groups/#{group2.id}", user1) delete api("/groups/#{group2.id}", user1)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
   
Loading
@@ -1061,13 +1061,13 @@ describe API::Groups do
Loading
@@ -1061,13 +1061,13 @@ describe API::Groups do
it "removes any existing group" do it "removes any existing group" do
delete api("/groups/#{group2.id}", admin) delete api("/groups/#{group2.id}", admin)
   
expect(response).to have_gitlab_http_status(202) expect(response).to have_gitlab_http_status(:accepted)
end end
   
it "does not remove a non existing group" do it "does not remove a non existing group" do
delete api("/groups/1328", admin) delete api("/groups/1328", admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -1086,7 +1086,7 @@ describe API::Groups do
Loading
@@ -1086,7 +1086,7 @@ describe API::Groups do
it "does not transfer project to group" do it "does not transfer project to group" do
post api("/groups/#{group1.id}/projects/#{project.id}", user2) post api("/groups/#{group1.id}/projects/#{project.id}", user2)
   
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
   
Loading
@@ -1094,7 +1094,7 @@ describe API::Groups do
Loading
@@ -1094,7 +1094,7 @@ describe API::Groups do
it "transfers project to group" do it "transfers project to group" do
post api("/groups/#{group1.id}/projects/#{project.id}", admin) post api("/groups/#{group1.id}/projects/#{project.id}", admin)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
   
context 'when using project path in URL' do context 'when using project path in URL' do
Loading
@@ -1102,7 +1102,7 @@ describe API::Groups do
Loading
@@ -1102,7 +1102,7 @@ describe API::Groups do
it "transfers project to group" do it "transfers project to group" do
post api("/groups/#{group1.id}/projects/#{project_path}", admin) post api("/groups/#{group1.id}/projects/#{project_path}", admin)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
end end
   
Loading
@@ -1110,7 +1110,7 @@ describe API::Groups do
Loading
@@ -1110,7 +1110,7 @@ describe API::Groups do
it "does not transfer project to group" do it "does not transfer project to group" do
post api("/groups/#{group1.id}/projects/nogroup%2Fnoproject", admin) post api("/groups/#{group1.id}/projects/nogroup%2Fnoproject", admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
@@ -1120,7 +1120,7 @@ describe API::Groups do
Loading
@@ -1120,7 +1120,7 @@ describe API::Groups do
it "transfers project to group" do it "transfers project to group" do
post api("/groups/#{group1.path}/projects/#{project_path}", admin) post api("/groups/#{group1.path}/projects/#{project_path}", admin)
   
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
end end
end end
   
Loading
@@ -1128,7 +1128,7 @@ describe API::Groups do
Loading
@@ -1128,7 +1128,7 @@ describe API::Groups do
it "does not transfer project to group" do it "does not transfer project to group" do
post api("/groups/noexist/projects/#{project_path}", admin) post api("/groups/noexist/projects/#{project_path}", admin)
   
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
Loading
Loading
Loading
@@ -269,7 +269,7 @@ describe API::Helpers do
Loading
@@ -269,7 +269,7 @@ describe API::Helpers do
   
# The 500 status is expected as we're testing a case where an exception # The 500 status is expected as we're testing a case where an exception
# is raised, but Grape shouldn't raise an additional exception # is raised, but Grape shouldn't raise an additional exception
expect(response).to have_gitlab_http_status(500) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(json_response['message']).not_to include("undefined local variable or method `request'") expect(json_response['message']).not_to include("undefined local variable or method `request'")
expect(json_response['message']).to start_with("\nRuntimeError (Runtime Error!):") expect(json_response['message']).to start_with("\nRuntimeError (Runtime Error!):")
end end
Loading
Loading
Loading
@@ -36,7 +36,7 @@ describe API::ImportGithub do
Loading
@@ -36,7 +36,7 @@ describe API::ImportGithub do
personal_access_token: token, personal_access_token: token,
repo_id: 1234 repo_id: 1234
} }
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(:created)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['name']).to eq(project.name) expect(json_response['name']).to eq(project.name)
end end
Loading
@@ -50,7 +50,7 @@ describe API::ImportGithub do
Loading
@@ -50,7 +50,7 @@ describe API::ImportGithub do
repo_id: 1234 repo_id: 1234
} }
   
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment