Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
cubicweb
cubes
api
Commits
ee9779e0555b
Commit
ee9779e0555b
authored
1 year ago
by
Arnaud Vergnet
Browse files
Options
Downloads
Patches
Plain Diff
test: add transaction rollback test
parent
1dc6b9bca586
No related branches found
No related tags found
1 merge request
!62
tests: improve coverage
Pipeline
#217002
passed with warnings
1 year ago
Stage: lint
Stage: tests
Stage: qa
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_api_rql.py
+32
-0
32 additions, 0 deletions
test/test_api_rql.py
with
32 additions
and
0 deletions
test/test_api_rql.py
+
32
−
0
View file @
ee9779e0
...
...
@@ -141,6 +141,38 @@
assert
isinstance
(
response
[
2
][
0
][
0
],
int
)
assert
isinstance
(
response
[
2
][
0
][
1
],
int
)
def
test_rollback_on_error
(
self
):
self
.
login_request
()
queries
=
[
{
"
query
"
:
"
INSERT CWUser U: U login %(login)s, U upassword
'
AZJEJAZO
'"
,
"
params
"
:
{
"
login
"
:
"
ginger
"
},
},
{
"
query
"
:
"
SET U in_group G WHERE U eid
'
test
'"
,
"
params
"
:
{},
},
]
response
=
self
.
make_rql_request
(
queries
,
status
=
400
)
assert
response
==
{
"
data
"
:
None
,
"
message
"
:
"
781 (in_group-subject): at least one relation in_group is
"
"
required on CWUser (781)
"
,
"
title
"
:
"
ValidationError
"
,
}
# Check user not added, request should be rolled back
queries
=
[
{
"
query
"
:
"
Any X WHERE X login %(login)s
"
,
"
params
"
:
{
"
login
"
:
"
ginger
"
},
},
]
response
=
self
.
make_rql_request
(
queries
,
status
=
200
)
assert
response
==
[[]]
def
test_400_on_invalid_transactions
(
self
):
queries
=
[
{
...
...
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