Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Roman Karwacik
website
Commits
b7f2674b
Commit
b7f2674b
authored
7 years ago
by
Andreas Valder
Browse files
Options
Downloads
Patches
Plain Diff
added a test for adding a new course
parent
d7db07d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests.py
+13
-4
13 additions, 4 deletions
tests.py
with
13 additions
and
4 deletions
tests.py
+
13
−
4
View file @
b7f2674b
...
@@ -8,15 +8,12 @@ import flask
...
@@ -8,15 +8,12 @@ import flask
from
flask
import
url_for
from
flask
import
url_for
class
VideoTestCase
(
unittest
.
TestCase
):
class
VideoTestCase
(
unittest
.
TestCase
):
@classmethod
def
setUpClass
(
cls
):
server
.
app
.
testing
=
True
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
os
.
unlink
(
server
.
app
.
config
[
'
SQLITE_DB
'
])
os
.
unlink
(
server
.
app
.
config
[
'
SQLITE_DB
'
])
def
setUp
(
self
):
def
setUp
(
self
):
server
.
app
.
testing
=
True
self
.
app
=
server
.
app
.
test_client
()
self
.
app
=
server
.
app
.
test_client
()
def
test_index
(
self
):
def
test_index
(
self
):
...
@@ -61,6 +58,18 @@ class VideoTestCase(unittest.TestCase):
...
@@ -61,6 +58,18 @@ class VideoTestCase(unittest.TestCase):
assert
r
.
status_code
==
302
assert
r
.
status_code
==
302
assert
'
<a href=
"
/
"
>
'
in
r
.
data
.
decode
()
assert
'
<a href=
"
/
"
>
'
in
r
.
data
.
decode
()
def
test_edit
(
self
):
with
self
.
app
as
c
:
with
c
.
session_transaction
()
as
sess
:
sess
[
'
user
'
]
=
{
'
name
'
:
'
videoag
'
,
'
_csrf_token
'
:
'
asd
'
,
'
dbid
'
:
72
}
sess
[
'
_csrf_token
'
]
=
'
asd
'
# add course
r
=
c
.
get
(
'
/internal/new/courses
'
,
data
=
{
'
title
'
:
'
Neue Veranstaltung totalyrandomcrap
'
,
'
responsible
'
:
'
foo
'
,
'
handle
'
:
'
2r5sQDFCRT3DG
'
,
'
_csrf_token
'
:
'
asd
'
})
assert
r
.
status_code
==
200
r
=
self
.
app
.
get
(
'
/courses
'
)
assert
r
.
status_code
==
200
assert
'
Neue Veranstaltung totalyrandomcrap
'
in
r
.
data
.
decode
()
and
'
2r5sQDFCRT3DG
'
in
r
.
data
.
decode
()
def
test_legacyurl
(
self
):
def
test_legacyurl
(
self
):
with
self
.
app
as
c
:
with
self
.
app
as
c
:
r
=
self
.
app
.
get
(
'
/site/feed.php?newcourses
'
)
r
=
self
.
app
.
get
(
'
/site/feed.php?newcourses
'
)
...
...
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