summaryrefslogtreecommitdiff
path: root/spec/frontend/api_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /spec/frontend/api_spec.js
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r--spec/frontend/api_spec.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js
index 85332bf21d8..5f162f498c4 100644
--- a/spec/frontend/api_spec.js
+++ b/spec/frontend/api_spec.js
@@ -1593,6 +1593,38 @@ describe('Api', () => {
});
});
+ describe('uploadProjectSecureFile', () => {
+ it('uploads a secure file to a project', async () => {
+ const projectId = 1;
+ const secureFile = {
+ id: projectId,
+ title: 'File Name',
+ permissions: 'read_only',
+ checksum: '12345',
+ checksum_algorithm: 'sha256',
+ created_at: '2022-02-21T15:27:18',
+ };
+
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/secure_files`;
+ mock.onPost(expectedUrl).reply(httpStatus.OK, secureFile);
+ const { data } = await Api.uploadProjectSecureFile(projectId, 'some data');
+
+ expect(data).toEqual(secureFile);
+ });
+ });
+
+ describe('deleteProjectSecureFile', () => {
+ it('removes a secure file from a project', async () => {
+ const projectId = 1;
+ const secureFileId = 2;
+
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/secure_files/${secureFileId}`;
+ mock.onDelete(expectedUrl).reply(httpStatus.NO_CONTENT, '');
+ const { data } = await Api.deleteProjectSecureFile(projectId, secureFileId);
+ expect(data).toEqual('');
+ });
+ });
+
describe('dependency proxy cache', () => {
it('schedules the cache list for deletion', async () => {
const groupId = 1;