73
73
# create temp folder with databases and design documents in
74
super(TestUpdateDesignDocuments, self).setUp()
75
xdg_data = os.path.split(test_environment.test_context.db_dir)[0]
75
77
os.mkdir(os.path.join(xdg_data, "desktop-couch"))
90
92
couchdb = mocker.replace("desktopcouch.records.server.CouchDatabase")
92
94
# databases that should be created
93
couchdb("cfg", create=True)
94
couchdb("cfg_and_empty_design", create=True)
95
couchdb("cfg_and_design_no_views", create=True)
96
couchdb("cfg_and_design_one_view_no_map", create=True)
97
couchdb("cfg_and_design_one_view_map_no_reduce", create=True)
95
couchdb("cfg", create=True, ctx=test_environment.test_context)
97
"cfg_and_empty_design", create=True,
98
ctx=test_environment.test_context)
100
"cfg_and_design_no_views", create=True,
101
ctx=test_environment.test_context)
103
"cfg_and_design_one_view_no_map", create=True,
104
ctx=test_environment.test_context)
106
"cfg_and_design_one_view_map_no_reduce", create=True,
107
ctx=test_environment.test_context)
98
109
dbmock1 = mocker.mock()
99
110
mocker.result(dbmock1)
100
111
dbmock1.add_view("view1", "cfg_and_design_one_view_map_no_reduce:map",
102
couchdb("cfg_and_design_one_view_map_reduce", create=True)
114
"cfg_and_design_one_view_map_reduce", create=True,
115
ctx=test_environment.test_context)
103
116
dbmock2 = mocker.mock()
104
117
mocker.result(dbmock2)
105
118
dbmock2.add_view("view1", "cfg_and_design_one_view_map_reduce:map",
106
119
"cfg_and_design_one_view_map_reduce:reduce", "doc1")
107
couchdb("cfg_and_design_two_views_map_reduce", create=True)
121
"cfg_and_design_two_views_map_reduce", create=True,
122
ctx=test_environment.test_context)
108
123
dbmock3 = mocker.mock()
109
124
mocker.result(dbmock3)
110
125
dbmock3.add_view("view1", "cfg_and_design_two_views_map_reduce:map1",