本文整理匯總了Python中fjord.feedback.tests.ResponseFactory.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python ResponseFactory.delete方法的具體用法?Python ResponseFactory.delete怎麽用?Python ResponseFactory.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fjord.feedback.tests.ResponseFactory
的用法示例。
在下文中一共展示了ResponseFactory.delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_live_indexing
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import delete [as 別名]
def test_live_indexing(self):
search = ResponseDocType.docs.search()
count_pre = search.count()
s = ResponseFactory(happy=True, description="Test live indexing.")
self.refresh()
assert count_pre + 1 == search.count()
s.delete()
self.refresh()
assert count_pre == search.count()
示例2: test_live_indexing
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import delete [as 別名]
def test_live_indexing(self):
S = ResponseMappingType.search
count_pre = S().count()
s = ResponseFactory(happy=True, description='Test live indexing.')
self.refresh()
eq_(count_pre + 1, S().count())
s.delete()
self.refresh()
eq_(count_pre, S().count())
示例3: timezone_view
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import delete [as 別名]
def timezone_view(request):
"""Admin view showing times and timezones in data."""
# Note: This is an admin page that gets used once in a blue moon.
# As such, I'm taking some liberties (hand-indexing the response,
# time.sleep, etc) that I would never take if it was used more
# often or was viewable by users. If these two assumptions ever
# change, then this should be rewritten.
from fjord.feedback.models import (
Response,
ResponseDocType,
ResponseDocTypeManager
)
from fjord.feedback.tests import ResponseFactory
from fjord.search.index import get_es, get_index_name
server_time = datetime.now()
# Create a new response.
resp = ResponseFactory()
resp_time = resp.created
# Index the response by hand so we know it gets to
# Elasticsearch. Otherwise it gets done by celery and we don't
# know how long that'll take.
doc = ResponseDocType.extract_doc(resp)
ResponseDocTypeManager.bulk_index(docs=[doc])
# Fetch the response from the db.
resp = Response.objects.get(id=resp.id)
resp2_time = resp.created
# Refresh and sleep 5 seconds as a hand-wavey way to make sure
# that Elasticsearch has had time to refresh the index.
get_es().indices.refresh(get_index_name())
time.sleep(5)
s = ResponseDocTypeManager.search().filter('term', id=resp.id).execute()
es_time = s[0].created
# Delete the test response which also deletes it in the index.
resp.delete()
return render(request, 'admin/timezone_view.html', {
'server_time': server_time,
'resp_time': resp_time,
'resp2_time': resp2_time,
'es_time': es_time
})