Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Marc Feger
The Social Network
Commits
0f5173d3
Commit
0f5173d3
authored
Dec 07, 2021
by
Andreas Burbach
Browse files
add test
parent
416caa89
Pipeline
#76036
passed with stages
in 3 minutes and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
social_network/the_social_network/tests.py
View file @
0f5173d3
...
...
@@ -615,6 +615,29 @@ class TestGetStatementFeed(APITestCase):
self
.
assertTrue
(
result
[
0
].
get
(
"created"
)
>
result
[
1
].
get
(
"created"
))
self
.
assertTrue
(
result
[
1
].
get
(
"id"
)
>
result
[
2
].
get
(
"id"
))
self
.
assertTrue
(
result
[
1
].
get
(
"created"
)
>
result
[
2
].
get
(
"created"
))
def
test_feed_contains_correct_data_pagination
(
self
):
self
.
client
.
credentials
(
HTTP_AUTHORIZATION
=
'Token '
+
str
(
self
.
token_beate
))
response
:
Response
=
self
.
client
.
get
(
path
=
"/contents/statements/feed/pagination/?page=1&size=5"
)
result
=
response
.
data
[
"data"
]
result_total
=
response
.
data
[
"total"
]
self
.
assertTrue
(
len
(
result
),
3
)
self
.
assertTrue
(
result_total
,
3
)
self
.
assertEqual
(
result
[
0
].
get
(
"id"
),
self
.
statement_3
.
id
)
self
.
assertEqual
(
result
[
1
].
get
(
"id"
),
self
.
statement_2
.
id
)
self
.
assertEqual
(
result
[
2
].
get
(
"id"
),
self
.
statement_1
.
id
)
self
.
assertTrue
(
result
[
0
].
get
(
"id"
)
>
result
[
1
].
get
(
"id"
))
self
.
assertTrue
(
result
[
0
].
get
(
"created"
)
>
result
[
1
].
get
(
"created"
))
self
.
assertTrue
(
result
[
1
].
get
(
"id"
)
>
result
[
2
].
get
(
"id"
))
self
.
assertTrue
(
result
[
1
].
get
(
"created"
)
>
result
[
2
].
get
(
"created"
))
def
test_feed_contains_no_data_pagination
(
self
):
self
.
client
.
credentials
(
HTTP_AUTHORIZATION
=
'Token '
+
str
(
self
.
token_beate
))
response
:
Response
=
self
.
client
.
get
(
path
=
"/contents/statements/feed/pagination/?page=2&size=2"
)
result
=
response
.
data
[
"data"
]
result_total
=
response
.
data
[
"total"
]
self
.
assertTrue
(
len
(
result
),
0
)
self
.
assertTrue
(
result_total
,
3
)
class
TestTrendingHashtag
(
APITestCase
):
...
...
social_network/the_social_network/urls/contentUrls.py
View file @
0f5173d3
...
...
@@ -6,6 +6,6 @@ urlpatterns = [
path
(
'statements/get/<int:id>/'
,
ShowStatement
.
as_view
(),
name
=
"show_statement"
),
path
(
'statements/with/hashtag/'
,
ShowStatementsWithHashtag
.
as_view
(),
name
=
"show_statement_with_hashtag"
),
path
(
'statements/feed/'
,
ShowStatementFeed
.
as_view
(),
name
=
"show_statement_feed"
),
path
(
'statements/feed/pagination'
,
ShowStatementFeedPagination
.
as_view
(),
name
=
"show_statement_feed_pagination"
),
path
(
'statements/feed/pagination
/
'
,
ShowStatementFeedPagination
.
as_view
(),
name
=
"show_statement_feed_pagination"
),
path
(
'trending/hashtag/'
,
ShowTrendingHashtag
.
as_view
(),
name
=
"show_trending_hashtags"
),
]
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment