Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-notes-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-notes-api
Commits
48787f16
Commit
48787f16
authored
Dec 28, 2014
by
Tim Babych
Committed by
Oleg Marshev
Jan 05, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unicode-aware urlencode
parent
945a11fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
notesapi/v1/tests/test_views.py
+17
-3
No files found.
notesapi/v1/tests/test_views.py
View file @
48787f16
# -*- coding: utf-8 -*-
import
jwt
import
jwt
import
urllib
from
calendar
import
timegm
from
calendar
import
timegm
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
mock
import
patch
from
mock
import
patch
...
@@ -7,6 +7,7 @@ import unittest
...
@@ -7,6 +7,7 @@ import unittest
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.conf
import
settings
from
django.conf
import
settings
from
django.http
import
QueryDict
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.test
import
APITestCase
from
rest_framework.test
import
APITestCase
...
@@ -110,8 +111,9 @@ class BaseAnnotationViewTests(APITestCase):
...
@@ -110,8 +111,9 @@ class BaseAnnotationViewTests(APITestCase):
"""
"""
Helper for search method. All keyword parameters are passed in GET
Helper for search method. All keyword parameters are passed in GET
"""
"""
kwargs
.
update
({
"user"
:
TEST_USER
})
q
=
QueryDict
(
"user="
+
TEST_USER
,
mutable
=
True
)
url
=
reverse
(
'api:v1:annotations_search'
)
+
'?{}'
.
format
(
urllib
.
urlencode
(
kwargs
))
q
.
update
(
kwargs
)
url
=
reverse
(
'api:v1:annotations_search'
)
+
'?{}'
.
format
(
q
.
urlencode
())
result
=
self
.
client
.
get
(
url
)
result
=
self
.
client
.
get
(
url
)
return
result
.
data
return
result
.
data
...
@@ -329,6 +331,18 @@ class AnnotationViewTests(BaseAnnotationViewTests):
...
@@ -329,6 +331,18 @@ class AnnotationViewTests(BaseAnnotationViewTests):
self
.
assertEqual
(
results
[
'rows'
][
1
][
'text'
],
'Second note'
)
self
.
assertEqual
(
results
[
'rows'
][
1
][
'text'
],
'Second note'
)
self
.
assertEqual
(
results
[
'rows'
][
2
][
'text'
],
'First one'
)
self
.
assertEqual
(
results
[
'rows'
][
2
][
'text'
],
'First one'
)
# def test_search_unicode(self):
# """
# Tests searching of unicode strings.
# """
# self._create_annotation(text=u'Веселих свят')
# results = self._get_search_results(text=u"веселих".encode('utf-8'))
# self.assertEqual(results['total'], 1)
# results = self._get_search_results(text=u"свят")
# self.assertEqual(results['total'], 1)
def
test_read_all_no_annotations
(
self
):
def
test_read_all_no_annotations
(
self
):
"""
"""
Tests list all annotations endpoint when no annotations are present in elasticsearch.
Tests list all annotations endpoint when no annotations are present in elasticsearch.
...
...
Write
Preview
Markdown
is supported
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