Skip to content

Commit

Permalink
fix headers not work bug in fetcher, add test for mongodb 'system'
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Oct 30, 2014
1 parent 0b2f2a3 commit 6715bf2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fetcher/tornado_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def http_fetch(self, url, task, callback):
for each in self.allowed_options:
if each in task_fetch:
fetch[each] = task_fetch[each]
fetch['headers'].update(fetch.get('headers', {}))
fetch['headers'].update(task_fetch.get('headers', {}))

track_headers = task.get('track', {}).get('fetch', {}).get('headers', {})
#proxy
Expand Down
10 changes: 10 additions & 0 deletions test/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ def test_50_load_tasks(self):
self.assertEqual(tasks[0]['taskid'], 'taskid')
self.assertNotIn('project', tasks[0])

def test_60_relist_projects(self):
if hasattr(self.taskdb, '_list_project'):
self.taskdb._list_project()
self.assertNotIn('system.indexes', self.taskdb.projects)

def test_z900_drop(self):
self.taskdb.insert('project2', 'taskid', self.sample_task)
self.taskdb.insert('project3', 'taskid', self.sample_task)
Expand Down Expand Up @@ -267,6 +272,11 @@ def test_50_select_not_finished(self):
break
self.assertEqual(self.resultdb.count('test_project'), 6)

def test_60_relist_projects(self):
if hasattr(self.resultdb, '_list_project'):
self.resultdb._list_project()
self.assertNotIn('system.indexes', self.resultdb.projects)

def test_z900_drop(self):
self.resultdb.save('test_project2', 'test_taskid', 'test_url', 'result')
self.resultdb.save('test_project3', 'test_taskid', 'test_url', 'result')
Expand Down

0 comments on commit 6715bf2

Please sign in to comment.