def setUp(self): super(TestDiffSearchEngine, self).setUp() src = os.path.join(settings.ROOT, get_file('search.xml')) if not storage.exists(src): with storage.open(src, 'w') as f: f.write(open(src).read()) self.helper = DiffHelper(make_file(1, src, filename='search.xml'), make_file(2, src, filename='search.xml'))
def wrapper(request, one_id, two_id, *args, **kw): one = get_object_or_404(File, pk=one_id) two = get_object_or_404(File, pk=two_id) for obj in [one, two]: result = allowed(request, obj) if result is not True: return result try: obj = DiffHelper(one, two) except ObjectDoesNotExist: raise http.Http404 response = func(request, obj, *args, **kw) if obj.left.selected: response['ETag'] = '"%s"' % obj.left.selected.get('sha256') response['Last-Modified'] = http_date( obj.left.selected.get('modified')) return response
def setUp(self): super(TestDiffViewer, self).setUp() self.file_viewer = DiffHelper(self.files[0], self.files[1])
def setUp(self): super(TestDiffHelper, self).setUp() src = os.path.join(settings.ROOT, get_file('dictionary-test.xpi')) self.helper = DiffHelper(make_file(1, src), make_file(2, src))