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
5e36abb8
Verified
Commit
5e36abb8
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: fix tests broken by adding _id suffix
Four tests in `test_notes.py` still broken for now
parent
bb9218c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#3408
passed
1 year ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
conftest.py
+5
-3
5 additions, 3 deletions
conftest.py
program/tests/test_notes.py
+5
-2
5 additions, 2 deletions
program/tests/test_notes.py
program/tests/test_schedules.py
+2
-2
2 additions, 2 deletions
program/tests/test_schedules.py
program/tests/test_shows.py
+2
-2
2 additions, 2 deletions
program/tests/test_shows.py
with
14 additions
and
9 deletions
conftest.py
+
5
−
3
View file @
5e36abb8
...
@@ -14,15 +14,17 @@ from program.tests.factories import (
...
@@ -14,15 +14,17 @@ from program.tests.factories import (
ScheduleFactory
,
ScheduleFactory
,
ShowFactory
,
ShowFactory
,
TimeslotFactory
,
TimeslotFactory
,
TypeFactory
,
ImageFactory
,
TypeFactory
,
ImageFactory
,
)
)
def
assert_data
(
response
,
data
)
->
None
:
def
assert_data
(
response
,
data
)
->
None
:
if
"
schedule
"
in
data
:
if
"
schedule
"
in
data
:
for
key
,
value
in
data
[
"
schedule
"
].
items
():
for
key
,
value
in
data
[
"
schedule
"
].
items
():
if
key
==
"
rrule
"
:
# this is ugly but for some reason
assert
response
.
data
[
key
]
==
value
if
key
==
"
rrule_id
"
and
"
rrule
"
in
response
.
data
:
assert
response
.
data
[
"
rrule
"
]
==
value
else
:
else
:
assert
str
(
response
.
data
[
key
])
==
value
assert
str
(
response
.
data
[
key
])
==
value
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
program/tests/test_notes.py
+
5
−
2
View file @
5e36abb8
...
@@ -66,9 +66,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
...
@@ -66,9 +66,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
client
=
self
.
_get_client
(
self
.
user_admin
)
client
=
self
.
_get_client
(
self
.
user_admin
)
res
=
client
.
post
(
res
=
client
.
post
(
self
.
_url
(
"
notes
"
),
self
.
_url
(
"
notes
"
),
self
.
_create_random_note_content
(
timeslot
=
timeslot
.
id
),
self
.
_create_random_note_content
(
timeslot
_id
=
timeslot
.
id
),
format
=
"
json
"
,
format
=
"
json
"
,
)
)
print
(
res
.
content
)
self
.
assertEqual
(
res
.
status_code
,
201
)
self
.
assertEqual
(
res
.
status_code
,
201
)
def
test_notes_can_be_created_through_nested_routes
(
self
):
def
test_notes_can_be_created_through_nested_routes
(
self
):
...
@@ -77,8 +78,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
...
@@ -77,8 +78,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
# /shows/{pk}/notes/
# /shows/{pk}/notes/
ts1
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_musikrotation
)
ts1
=
self
.
_create_timeslot
(
schedule
=
self
.
schedule_musikrotation
)
url
=
self
.
_url
(
"
shows
"
,
self
.
show_musikrotation
.
id
,
"
notes
"
)
url
=
self
.
_url
(
"
shows
"
,
self
.
show_musikrotation
.
id
,
"
notes
"
)
note
=
self
.
_create_random_note_content
(
title
=
"
meh
"
,
timeslot
=
ts1
.
id
)
note
=
self
.
_create_random_note_content
(
title
=
"
meh
"
,
timeslot_id
=
ts1
.
id
)
print
(
note
)
res
=
client
.
post
(
url
,
note
,
format
=
"
json
"
)
res
=
client
.
post
(
url
,
note
,
format
=
"
json
"
)
print
(
res
.
content
)
self
.
assertEqual
(
res
.
status_code
,
201
)
self
.
assertEqual
(
res
.
status_code
,
201
)
# /shows/{pk}/timeslots/{pk}/note/
# /shows/{pk}/timeslots/{pk}/note/
...
...
This diff is collapsed.
Click to expand it.
program/tests/test_schedules.py
+
2
−
2
View file @
5e36abb8
...
@@ -30,7 +30,7 @@ def schedule_data(rrule) -> dict[str, dict[str | int]]:
...
@@ -30,7 +30,7 @@ def schedule_data(rrule) -> dict[str, dict[str | int]]:
"
end_time
"
:
in_an_hour
.
strftime
(
"
%H:%M:%S
"
),
"
end_time
"
:
in_an_hour
.
strftime
(
"
%H:%M:%S
"
),
"
first_date
"
:
now
.
strftime
(
"
%Y-%m-%d
"
),
"
first_date
"
:
now
.
strftime
(
"
%Y-%m-%d
"
),
"
last_date
"
:
in_a_year
.
strftime
(
"
%Y-%m-%d
"
),
"
last_date
"
:
in_a_year
.
strftime
(
"
%Y-%m-%d
"
),
"
rrule
"
:
rrule
.
id
,
"
rrule
_id
"
:
rrule
.
id
,
"
start_time
"
:
now
.
strftime
(
"
%H:%M:%S
"
),
"
start_time
"
:
now
.
strftime
(
"
%H:%M:%S
"
),
},
},
}
}
...
@@ -209,7 +209,7 @@ def test_update_schedule(admin_api_client, once_schedule):
...
@@ -209,7 +209,7 @@ def test_update_schedule(admin_api_client, once_schedule):
"
first_date
"
:
once_schedule
.
first_date
,
"
first_date
"
:
once_schedule
.
first_date
,
"
start_time
"
:
once_schedule
.
start_time
,
"
start_time
"
:
once_schedule
.
start_time
,
"
end_time
"
:
once_schedule
.
end_time
,
"
end_time
"
:
once_schedule
.
end_time
,
"
rrule
"
:
once_schedule
.
rrule
.
id
,
"
rrule
_id
"
:
once_schedule
.
rrule
.
id
,
},
},
}
}
...
...
This diff is collapsed.
Click to expand it.
program/tests/test_shows.py
+
2
−
2
View file @
5e36abb8
...
@@ -12,11 +12,11 @@ def url(show=None) -> str:
...
@@ -12,11 +12,11 @@ def url(show=None) -> str:
def
show_data
(
funding_category
,
type_
)
->
dict
[
str
,
str
|
int
]:
def
show_data
(
funding_category
,
type_
)
->
dict
[
str
,
str
|
int
]:
return
{
return
{
"
funding_category
"
:
funding_category
.
id
,
"
funding_category
_id
"
:
funding_category
.
id
,
"
name
"
:
"
NAME
"
,
"
name
"
:
"
NAME
"
,
"
short_description
"
:
"
SHORT DESCRIPTION
"
,
"
short_description
"
:
"
SHORT DESCRIPTION
"
,
"
slug
"
:
"
SLUG
"
,
"
slug
"
:
"
SLUG
"
,
"
type
"
:
type_
.
id
,
"
type
_id
"
:
type_
.
id
,
}
}
...
...
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