Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
AURA
steering
Commits
31956b82
Verified
Commit
31956b82
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: remove skiped note tests with nested routes
parent
82a939d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/tests/test_notes.py
+1
-55
1 addition, 55 deletions
program/tests/test_notes.py
with
1 addition
and
55 deletions
program/tests/test_notes.py
+
1
−
55
View file @
31956b82
from
rest_framework.test
import
APITransactionTestCase
from
rest_framework.test
import
APITransactionTestCase
from
unittest
import
skip
from
program
import
tests
from
program
import
tests
from
program.models
import
Schedule
,
Show
from
program.models
import
Schedule
,
Show
...
@@ -70,57 +70,3 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
...
@@ -70,57 +70,3 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
format
=
"
json
"
,
format
=
"
json
"
,
)
)
self
.
assertEqual
(
res
.
status_code
,
201
)
self
.
assertEqual
(
res
.
status_code
,
201
)
@skip
(
"
nested routes are deprecated
"
)
def
test_notes_can_be_created_through_nested_routes
(
self
):
client
=
self
.
_get_client
(
self
.
user_admin
)
# /shows/{pk}/notes/
ts1
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_musikrotation
)
url
=
self
.
_url
(
"
shows
"
,
self
.
show_musikrotation
.
id
,
"
notes
"
)
note
=
self
.
_create_random_note_content
(
title
=
"
meh
"
,
timeslot_id
=
ts1
.
id
)
res
=
client
.
post
(
url
,
note
,
format
=
"
json
"
)
self
.
assertEqual
(
res
.
status_code
,
201
)
# /shows/{pk}/timeslots/{pk}/note/
ts2
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_musikrotation
)
url
=
self
.
_url
(
"
shows
"
,
self
.
show_musikrotation
,
"
timeslots
"
,
ts2
.
id
,
"
note
"
)
note
=
self
.
_create_random_note_content
(
title
=
"
cool
"
)
res
=
client
.
post
(
url
,
note
,
format
=
"
json
"
)
self
.
assertEqual
(
res
.
status_code
,
201
)
@skip
(
"
nested routes are deprecated
"
)
def
test_notes_can_be_filtered_through_nested_routes_and_query_params
(
self
):
client
=
self
.
_get_client
()
ts1
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_musikrotation
)
ts2
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_beatbetrieb
)
ts3
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_beatbetrieb
)
n1
=
self
.
_create_note
(
timeslot
=
ts1
)
n2
=
self
.
_create_note
(
timeslot
=
ts2
)
n3
=
self
.
_create_note
(
timeslot
=
ts3
)
def
_get_ids
(
res
):
return
set
(
ts
[
"
id
"
]
for
ts
in
res
.
data
)
# /shows/{pk}/notes/
query_res
=
client
.
get
(
self
.
_url
(
"
notes
"
)
+
f
"
?showIds=
{
self
.
show_beatbetrieb
.
id
}
"
)
route_res
=
client
.
get
(
self
.
_url
(
"
shows
"
,
self
.
show_beatbetrieb
.
id
,
"
notes
"
))
ids
=
{
n2
.
id
,
n3
.
id
}
self
.
assertEqual
(
_get_ids
(
query_res
),
ids
)
self
.
assertEqual
(
_get_ids
(
route_res
),
ids
)
query_res
=
client
.
get
(
self
.
_url
(
"
notes
"
)
+
f
"
?showIds=
{
self
.
show_musikrotation
.
id
}
"
)
route_res
=
client
.
get
(
self
.
_url
(
"
shows
"
,
self
.
show_musikrotation
.
id
,
"
notes
"
))
ids
=
{
n1
.
id
}
self
.
assertEqual
(
_get_ids
(
query_res
),
ids
)
self
.
assertEqual
(
_get_ids
(
route_res
),
ids
)
# /shows/{pk}/timeslots/{pk}/note/
query_res
=
client
.
get
(
self
.
_url
(
"
notes
"
)
+
f
"
?timeslot=
{
ts2
.
id
}
"
)
route_res
=
client
.
get
(
self
.
_url
(
"
shows
"
,
self
.
show_beatbetrieb
.
id
,
"
timeslots
"
,
ts2
.
id
,
"
note
"
)
)
ids
=
{
n2
.
id
}
self
.
assertEqual
(
_get_ids
(
query_res
),
ids
)
self
.
assertEqual
(
_get_ids
(
route_res
),
ids
)
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