File tree Expand file tree Collapse file tree 6 files changed +43
-0
lines changed Expand file tree Collapse file tree 6 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
2
3
"""
3
4
Load design documents from the filesystem into a dict.
4
5
Subset of couchdbkit/couchapp functionality.
Original file line number Diff line number Diff line change
1
+ _design/loader
Original file line number Diff line number Diff line change
1
+ function ( doc , req ) { return true ; }
Original file line number Diff line number Diff line change
1
+ javascript
Original file line number Diff line number Diff line change
1
+ function ( doc ) {
2
+ emit ( doc . property_to_index ) ;
3
+ }
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2016 Daniel Holth
4
+ # All rights reserved.
5
+ #
6
+ # This software is licensed as described in the file COPYING, which
7
+ # you should have received as part of this distribution.
8
+
9
+ import unittest
10
+ import os .path
11
+
12
+ from couchdb import loader
13
+ from couchdb .tests import testutil
14
+
15
+ expected = {
16
+ '_id' : u'_design/loader' ,
17
+ 'filters' : {'filter' : u'function(doc, req) { return true; }' },
18
+ 'language' : u'javascript' ,
19
+ 'views' : {'a' : {'map' : u'function(doc) {\n emit(doc.property_to_index);\n }' }}}
20
+
21
+ class LoaderTestCase (unittest .TestCase ):
22
+
23
+ def test_loader (self ):
24
+ directory = os .path .join (os .path .dirname (__file__ ), '_loader' )
25
+ doc = loader .load_design_doc (directory , strip_files = True )
26
+ self .assertEqual (doc , expected )
27
+
28
+
29
+ def suite ():
30
+ suite = unittest .TestSuite ()
31
+ suite .addTest (unittest .makeSuite (LoaderTestCase ))
32
+ return suite
33
+
34
+
35
+ if __name__ == '__main__' :
36
+ unittest .main (defaultTest = 'suite' )
You can’t perform that action at this time.
0 commit comments