Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
django-cas-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Samir
django-cas-server
Commits
d25f738b
Commit
d25f738b
authored
Aug 01, 2016
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for utils.dictfetchall
parent
c6583c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
cas_server/tests/test_utils.py
cas_server/tests/test_utils.py
+14
-0
No files found.
cas_server/tests/test_utils.py
View file @
d25f738b
...
...
@@ -11,9 +11,11 @@
# (c) 2016 Valentin Samir
"""Tests module for utils"""
from
django.test
import
TestCase
,
RequestFactory
from
django.db
import
connection
import
six
import
warnings
import
datetime
from
cas_server
import
utils
...
...
@@ -237,3 +239,15 @@ class UtilsTestCase(TestCase):
# version is cached 24h so calling it a second time should return the save value
self
.
assertEqual
(
version
,
utils
.
last_version
())
def
test_dictfetchall
(
self
):
"""test the function dictfetchall"""
with
connection
.
cursor
()
as
curs
:
curs
.
execute
(
"SELECT * FROM django_migrations"
)
results
=
utils
.
dictfetchall
(
curs
)
self
.
assertIsInstance
(
results
,
list
)
self
.
assertTrue
(
len
(
results
)
>
0
)
for
result
in
results
:
self
.
assertIsInstance
(
result
,
dict
)
self
.
assertIn
(
'applied'
,
result
)
self
.
assertIsInstance
(
result
[
'applied'
],
datetime
.
datetime
)
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