Commit 0dacc63d9252df92171fb2543582d04cbd2f505c
Committed by
Sergio Oliveira
1 parent
0c48b4b5
Exists in
trac_indexing
Add test for dict_fetch_all using fixtures
Showing
3 changed files
with
32 additions
and
0 deletions
Show diff stats
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +[{"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.058Z", "user": null}, "model": "trac.wiki", "pk": "CamelCase"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.010Z", "user": null}, "model": "trac.wiki", "pk": "InterMapTxt"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.023Z", "user": null}, "model": "trac.wiki", "pk": "InterTrac"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.017Z", "user": null}, "model": "trac.wiki", "pk": "InterWiki"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.040Z", "user": null}, "model": "trac.wiki", "pk": "PageTemplates"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.122Z", "user": null}, "model": "trac.wiki", "pk": "RecentChanges"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.061Z", "user": null}, "model": "trac.wiki", "pk": "SandBox"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.033Z", "user": null}, "model": "trac.wiki", "pk": "TitleIndex"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.142Z", "user": null}, "model": "trac.wiki", "pk": "TracAccessibility"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.174Z", "user": null}, "model": "trac.wiki", "pk": "TracAdmin"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.206Z", "user": null}, "model": "trac.wiki", "pk": "TracBackup"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.030Z", "user": null}, "model": "trac.wiki", "pk": "TracBatchModify"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.097Z", "user": null}, "model": "trac.wiki", "pk": "TracBrowser"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.050Z", "user": null}, "model": "trac.wiki", "pk": "TracCgi"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.177Z", "user": null}, "model": "trac.wiki", "pk": "TracChangeset"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.046Z", "user": null}, "model": "trac.wiki", "pk": "TracEnvironment"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.196Z", "user": null}, "model": "trac.wiki", "pk": "TracFastCgi"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.190Z", "user": null}, "model": "trac.wiki", "pk": "TracFineGrainedPermissions"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.116Z", "user": null}, "model": "trac.wiki", "pk": "TracGuide"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.100Z", "user": null}, "model": "trac.wiki", "pk": "TracImport"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.180Z", "user": null}, "model": "trac.wiki", "pk": "TracIni"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.087Z", "user": null}, "model": "trac.wiki", "pk": "TracInstall"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.037Z", "user": null}, "model": "trac.wiki", "pk": "TracInterfaceCustomization"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.139Z", "user": null}, "model": "trac.wiki", "pk": "TracLinks"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.020Z", "user": null}, "model": "trac.wiki", "pk": "TracLogging"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.126Z", "user": null}, "model": "trac.wiki", "pk": "TracModPython"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.135Z", "user": null}, "model": "trac.wiki", "pk": "TracModWSGI"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.027Z", "user": null}, "model": "trac.wiki", "pk": "TracNavigation"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.145Z", "user": null}, "model": "trac.wiki", "pk": "TracNotification"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.170Z", "user": null}, "model": "trac.wiki", "pk": "TracPermissions"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.164Z", "user": null}, "model": "trac.wiki", "pk": "TracPlugins"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.119Z", "user": null}, "model": "trac.wiki", "pk": "TracQuery"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.129Z", "user": null}, "model": "trac.wiki", "pk": "TracReports"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.084Z", "user": null}, "model": "trac.wiki", "pk": "TracRepositoryAdmin"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.158Z", "user": null}, "model": "trac.wiki", "pk": "TracRevisionLog"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.183Z", "user": null}, "model": "trac.wiki", "pk": "TracRoadmap"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.154Z", "user": null}, "model": "trac.wiki", "pk": "TracRss"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.067Z", "user": null}, "model": "trac.wiki", "pk": "TracSearch"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.064Z", "user": null}, "model": "trac.wiki", "pk": "TracStandalone"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.151Z", "user": null}, "model": "trac.wiki", "pk": "TracSupport"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.076Z", "user": null}, "model": "trac.wiki", "pk": "TracSyntaxColoring"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.113Z", "user": null}, "model": "trac.wiki", "pk": "TracTickets"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.203Z", "user": null}, "model": "trac.wiki", "pk": "TracTicketsCustomFields"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.071Z", "user": null}, "model": "trac.wiki", "pk": "TracTimeline"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:22Z", "modified": "2015-02-11T16:13:15.054Z", "user": null}, "model": "trac.wiki", "pk": "TracUnicode"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.193Z", "user": null}, "model": "trac.wiki", "pk": "TracUpgrade"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.132Z", "user": null}, "model": "trac.wiki", "pk": "TracWiki"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.080Z", "user": null}, "model": "trac.wiki", "pk": "TracWorkflow"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.110Z", "user": null}, "model": "trac.wiki", "pk": "WikiDeletePage"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.167Z", "user": null}, "model": "trac.wiki", "pk": "WikiFormatting"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.200Z", "user": null}, "model": "trac.wiki", "pk": "WikiHtml"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.107Z", "user": null}, "model": "trac.wiki", "pk": "WikiMacros"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.103Z", "user": null}, "model": "trac.wiki", "pk": "WikiNewPage"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.161Z", "user": null}, "model": "trac.wiki", "pk": "WikiPageNames"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.090Z", "user": null}, "model": "trac.wiki", "pk": "WikiProcessors"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.187Z", "user": null}, "model": "trac.wiki", "pk": "WikiRestructuredText"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.094Z", "user": null}, "model": "trac.wiki", "pk": "WikiRestructuredTextLinks"}, {"fields": {"collaborators": "[u'trac']", "author": "trac", "wiki_text": "", "created": "2015-02-09T19:57:23Z", "modified": "2015-02-11T16:13:15.148Z", "user": null}, "model": "trac.wiki", "pk": "WikiStart"}] | ||
0 | \ No newline at end of file | 2 | \ No newline at end of file |
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +""" | ||
2 | +Test DataAPI class. | ||
3 | +Objective: Test parameters and behavior. | ||
4 | +""" | ||
5 | +from colab.proxy.trac.data_api import TracDataAPI | ||
6 | + | ||
7 | +from django.db import connections | ||
8 | +from django.test import TestCase | ||
9 | + | ||
10 | + | ||
11 | +class TracDataAPITest(TestCase): | ||
12 | + | ||
13 | + fixtures = ["trac_data.json"] | ||
14 | + def setUp(self): | ||
15 | + self.connection = connections['default'] | ||
16 | + self.cursor = self.connection.cursor() | ||
17 | + | ||
18 | + def tearDown(self): | ||
19 | + self.connection.close() | ||
20 | + | ||
21 | + def test_dict_fetch_all(self): | ||
22 | + trac_dict= TracDataAPI() | ||
23 | + self.cursor.execute(''' SELECT * FROM trac_wiki;''') | ||
24 | + dict_result = trac_dict.dictfetchall(self.cursor) | ||
25 | + self.assertIn('collaborators', dict_result[0]) | ||
26 | + | ||
27 | + def test_dict_fetch_all_is_dict(self): | ||
28 | + trac_dict= TracDataAPI() | ||
29 | + self.cursor.execute(''' SELECT * FROM trac_wiki;''') | ||
30 | + dict_result = trac_dict.dictfetchall(self.cursor) | ||
31 | + self.assertIsInstance(dict_result[0], dict) |