Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
680e2dc6
Commit
680e2dc6
authored
Dec 26, 2020
by
HeJ
Browse files
Options
Downloads
Patches
Plain Diff
API: unit test for schedule/event endpoint
parent
85b31528
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/tests/__init__.py
+2
-0
2 additions, 0 deletions
src/api/tests/__init__.py
src/api/tests/schedule.py
+61
-0
61 additions, 0 deletions
src/api/tests/schedule.py
with
63 additions
and
0 deletions
src/api/tests/__init__.py
+
2
−
0
View file @
680e2dc6
from
.bbb
import
*
# noqa: F401, F403
from
.engelsystem
import
*
# noqa: F401, F403
from
.schedule
import
*
# noqa: F401, F403
from
.workadventure
import
*
# noqa: F401, F403
__all__
=
'
*
'
This diff is collapsed.
Click to expand it.
src/api/tests/schedule.py
0 → 100644
+
61
−
0
View file @
680e2dc6
import
json
from
django.test
import
TestCase
from
django.urls
import
reverse
from
rest_framework.authtoken.models
import
Token
from
core.models
import
Assembly
,
Conference
,
Event
,
PlatformUser
,
Room
class
ScheduleTest
(
TestCase
):
def
test_push_event
(
self
):
conf
=
Conference
(
slug
=
'
conf
'
,
name
=
'
TestConf
'
,
is_public
=
True
)
conf
.
save
()
conf
.
tracks
.
create
(
name
=
'
Community
'
).
save
()
assembly
=
Assembly
(
name
=
'
TestAssembly
'
,
slug
=
'
asmbly
'
,
conference
=
conf
)
assembly
.
save
()
room
=
Room
(
conference
=
conf
,
assembly
=
assembly
,
name
=
'
Foo Room
'
,
room_type
=
Room
.
RoomType
.
STAGE
)
room
.
save
()
user
=
PlatformUser
(
username
=
'
bernd
'
,
is_active
=
True
)
user
.
save
()
token
=
Token
(
user
=
user
)
token
.
save
()
event
=
Event
(
conference
=
conf
,
assembly
=
assembly
,
name
=
'
Example Event
'
)
event
.
save
()
update
=
{
"
url
"
:
"
https://fahrplan.events.ccc.de/rc3/2020/Fahrplan/events/11583.html
"
,
"
id
"
:
11583
,
"
guid
"
:
str
(
event
.
id
),
"
logo
"
:
None
,
"
date
"
:
"
2020-12-27T12:20:00+01:00
"
,
"
start
"
:
"
12:20
"
,
"
duration
"
:
"
00:30
"
,
"
room
"
:
"
foo room
"
,
"
slug
"
:
"
rc3-11583-rc3_eroffnung
"
,
"
title
"
:
"
#rC3 Er
\u00f6
ffnung
"
,
"
subtitle
"
:
""
,
"
track
"
:
"
Community
"
,
"
type
"
:
"
Talk
"
,
"
language
"
:
"
de
"
,
"
abstract
"
:
"
Willkommen zur ersten und hoffentlich einzigen Remote Chaos Experience!
"
,
"
description
"
:
""
,
"
recording_license
"
:
""
,
"
do_not_record
"
:
False
,
"
persons
"
:
[{
"
id
"
:
14151
,
"
public_name
"
:
"
blubbel
"
}],
"
links
"
:
[],
"
attachments
"
:
[]
}
url
=
reverse
(
'
api:event-schedule
'
,
kwargs
=
{
'
conference
'
:
conf
.
slug
,
'
pk
'
:
event
.
pk
})
with
self
.
modify_settings
(
API_USERS
=
{
'
append
'
:
user
.
username
}):
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
update
),
content_type
=
'
application/json
'
,
HTTP_AUTHORIZATION
=
f
'
Token
{
token
.
key
}
'
)
self
.
assertEqual
(
201
,
resp
.
status_code
,
f
'
Unexpected result from POST:
{
resp
.
content
}
'
)
event
.
refresh_from_db
()
self
.
assertTrue
(
'
rC3
'
in
event
.
name
,
f
'
Expected
"
rC3
"
in event name
"
{
event
.
name
}
"
.
'
)
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