Project

General

Profile

Patch #32094 » remove_unnecessary_calls_to_set_tmp_attachments_directory.patch

Go MAEDA, 2019-09-19 17:02

View differences:

test/functional/attachments_controller_test.rb
46 46
      assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
47 47
      assert_select 'td.line-code', :text => /Demande créée avec succès/
48 48
    end
49
    set_tmp_attachments_directory
50 49
  end
51 50

  
52 51
  def test_show_diff_replace_cannot_convert_content
......
64 63
        assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
65 64
      end
66 65
    end
67
    set_tmp_attachments_directory
68 66
  end
69 67

  
70 68
  def test_show_diff_latin_1
......
82 80
        assert_select 'td.line-code', :text => /Demande créée avec succès/
83 81
      end
84 82
    end
85
    set_tmp_attachments_directory
86 83
  end
87 84

  
88 85
  def test_show_should_save_diff_type_as_user_preference
......
132 129
      }
133 130
    assert_response :success
134 131
    assert_equal 'text/html', @response.content_type
135
    set_tmp_attachments_directory
136 132
  end
137 133

  
138 134
  def test_show_text_file_utf_8
......
207 203
      assert_equal 'text/html', @response.content_type
208 204
      assert_select '.nodata', :text => 'No preview available. Download the file instead.'
209 205
    end
210
    set_tmp_attachments_directory
211 206
  end
212 207

  
213 208
  def test_show_image
......
227 222
      }
228 223
    assert_equal 'text/html', @response.content_type
229 224
    assert_select '.nodata', :text => 'No preview available. Download the file instead.'
230
    set_tmp_attachments_directory
231 225
  end
232 226

  
233 227
  def test_show_file_from_private_issue_without_permission
......
235 229
        :id => 15
236 230
      }
237 231
    assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
238
    set_tmp_attachments_directory
239 232
  end
240 233

  
241 234
  def test_show_file_from_private_issue_with_permission
......
245 238
      }
246 239
    assert_response :success
247 240
    assert_select 'h2', :text => /private.diff/
248
    set_tmp_attachments_directory
249 241
  end
250 242

  
251 243
  def test_show_file_without_container_should_be_allowed_to_author
......
291 283

  
292 284
    assert_select 'ul.pages li.next', :text => /next/i
293 285
    assert_select 'ul.pages li.previous', :text => /previous/i
294

  
295
    set_tmp_attachments_directory
296 286
  end
297 287

  
298 288
  def test_download_text_file
......
309 299
        :id => 4
310 300
      }
311 301
    assert_response 304
312

  
313
    set_tmp_attachments_directory
314 302
  end
315 303

  
316 304
  def test_download_js_file
......
344 332
      }
345 333
    assert_response :success
346 334
    assert_equal 'text/x-ruby', @response.content_type
347
    set_tmp_attachments_directory
348 335
  end
349 336

  
350 337
  def test_download_should_assign_better_content_type_than_application_octet_stream
......
355 342
      }
356 343
    assert_response :success
357 344
    assert_equal 'text/x-ruby', @response.content_type
358
    set_tmp_attachments_directory
359 345
  end
360 346

  
361 347
  def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined
......
365 351
    assert_response :success
366 352
    assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename)
367 353
    assert_equal 'application/octet-stream', @response.content_type
368
    set_tmp_attachments_directory
369 354
  end
370 355

  
371 356
  def test_download_missing_file
......
373 358
        :id => 2
374 359
      }
375 360
    assert_response 404
376
    set_tmp_attachments_directory
377 361
  end
378 362

  
379 363
  def test_download_should_be_denied_without_permission
......
381 365
        :id => 7
382 366
      }
383 367
    assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
384
    set_tmp_attachments_directory
385 368
  end
386 369

  
387 370
  if convert_installed?
test/integration/api_test/attachments_test.rb
61 61
  test "GET /attachments/:id.xml should deny access without credentials" do
62 62
    get '/attachments/7.xml'
63 63
    assert_response 401
64
    set_tmp_attachments_directory
65 64
  end
66 65

  
67 66
  test "GET /attachments/download/:id/:filename should return the attachment content" do
68 67
    get '/attachments/download/7/archive.zip', :headers => credentials('jsmith')
69 68
    assert_response :success
70 69
    assert_equal 'application/zip', @response.content_type
71
    set_tmp_attachments_directory
72 70
  end
73 71

  
74 72
  test "GET /attachments/download/:id/:filename should deny access without credentials" do
75 73
    get '/attachments/download/7/archive.zip'
76 74
    assert_response 401
77
    set_tmp_attachments_directory
78 75
  end
79 76

  
80 77
  test "GET /attachments/thumbnail/:id should return the thumbnail" do
    (1-1/1)