瀏覽代碼

[search] Add a MockResource.invoke and head method

This fixes the search.tests.TestWithMockedSolr tests
Erick Tryzelaar 10 年之前
父節點
當前提交
e152be9c07
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      apps/search/src/search/tests.py

+ 11 - 0
apps/search/src/search/tests.py

@@ -52,6 +52,17 @@ class MockResource():
   def set_solr_response(cls, response):
     MockResource.RESPONSE = response
 
+  def invoke(self, method, *args, **kwargs):
+    if method.lower() == 'head':
+      return self.head(*args, **kwargs)
+    elif method.lower() == 'get':
+      return self.get(*args, **kwargs)
+    else:
+      raise Exception('do not know how to handle %s' % method)
+
+  def head(self, *args, **kwargs):
+    return ''
+
   def get(self, *args, **kwargs):
     if 'collection_1/admin/file' in args[0]:
       return SOLR_SCHEMA