Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bb8af186
Commit
bb8af186
authored
Apr 05, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for overriding classification on import
parent
c00fcc68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
ee/spec/requests/api/project_import_spec.rb
ee/spec/requests/api/project_import_spec.rb
+37
-0
ee/spec/requests/api/projects_spec.rb
ee/spec/requests/api/projects_spec.rb
+22
-0
No files found.
ee/spec/requests/api/project_import_spec.rb
0 → 100644
View file @
bb8af186
require
'spec_helper'
describe
API
::
ProjectImport
do
include
ExternalAuthorizationServiceHelpers
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_export_spec"
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:file
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'features'
,
'projects'
,
'import_export'
,
'test_project_export.tar.gz'
)
}
let
(
:namespace
)
{
create
(
:group
)
}
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
namespace
.
add_owner
(
user
)
end
after
do
FileUtils
.
rm_rf
(
export_path
,
secure:
true
)
end
describe
'POST /projects/import'
do
it
'overrides the classification label when the service is enabled'
do
enable_external_authorization_service_check
override_params
=
{
'external_authorization_classification_label'
=>
'Hello world'
}
Sidekiq
::
Testing
.
inline!
do
post
api
(
'/projects/import'
,
user
),
path:
'test-import'
,
file:
fixture_file_upload
(
file
),
namespace:
namespace
.
id
,
override_params:
override_params
end
import_project
=
Project
.
find
(
json_response
[
'id'
])
expect
(
import_project
.
external_authorization_classification_label
).
to
eq
(
'Hello world'
)
end
end
end
ee/spec/requests/api/projects_spec.rb
0 → 100644
View file @
bb8af186
require
'spec_helper'
describe
API
::
Projects
do
include
ExternalAuthorizationServiceHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
describe
'PUT /projects/:id'
do
before
do
enable_external_authorization_service_check
end
it
'updates the classification label when enabled'
do
put
(
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
external_authorization_classification_label:
'new label'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
project
.
reload
.
external_authorization_classification_label
).
to
eq
(
'new label'
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment