Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ESAP DB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
ESCAPE WP5
ESAP DB
Commits
0bcc0abc
Commit
0bcc0abc
authored
3 years ago
by
Pierre Chanial
Browse files
Options
Downloads
Patches
Plain Diff
API GET project.
parent
51e5b6c6
No related branches found
No related tags found
No related merge requests found
Pipeline
#15406
passed
3 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/apis/v0/projects.py
+11
-0
11 additions, 0 deletions
app/apis/v0/projects.py
tests/functional/v0/test_projects.py
+10
-5
10 additions, 5 deletions
tests/functional/v0/test_projects.py
with
21 additions
and
5 deletions
app/apis/v0/projects.py
+
11
−
0
View file @
0bcc0abc
...
...
@@ -100,3 +100,14 @@ def _update_server_available_size(
.
values
(
available_size
=
available_size
)
)
session
.
execute
(
stmt
)
@router.get
(
'
/{project}
'
,
summary
=
'
Gets a project.
'
,
response_model
=
Project
)
def
get_project
(
project
:
str
,
*
,
session
:
Session
=
Depends
(
get_session
))
->
DBProject
:
"""
Gets a project visible to a user.
"""
stmt
=
select
(
DBProject
).
where
(
DBProject
.
name
==
project
)
db_project
=
session
.
execute
(
stmt
).
scalars
().
first
()
if
db_project
is
None
:
msg
=
f
"
The project
'
{
project
}
'
is not known.
"
raise
HTTPException
(
status
.
HTTP_404_NOT_FOUND
,
msg
)
return
db_project
This diff is collapsed.
Click to expand it.
tests/functional/v0/test_projects.py
+
10
−
5
View file @
0bcc0abc
...
...
@@ -14,13 +14,18 @@ def test_create_project(client: TestClient) -> None:
)
response
=
client
.
post
(
f
'
{
settings
.
API_V0_STR
}
/projects
'
,
json
=
project
.
dict
())
assert
response
.
status_code
==
200
,
response
.
json
()[
'
detail
'
]
actual
=
Project
(
**
response
.
json
())
assert
actual
.
id
is
not
None
actual
.
id
=
project
.
id
assert
actual
==
project
project_post
=
Project
(
**
response
.
json
())
assert
project_post
.
id
is
not
None
project
.
id
=
project_post
.
id
assert
project_post
==
project
response
=
client
.
get
(
f
'
{
settings
.
API_V0_STR
}
/projects/
{
project
.
name
}
'
)
assert
response
.
status_code
==
200
,
response
.
json
()[
'
detail
'
]
project_get
=
Project
(
**
response
.
json
())
assert
project_get
==
project_post
def
test_list_project
(
client
:
TestClient
)
->
None
:
def
test_list_project
s
(
client
:
TestClient
)
->
None
:
project
=
Project
(
name
=
uid
(
'
project
'
),
description
=
uid
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment