File: fix-blocks-test.patch

package info (click to toggle)
asciidoctor 2.0.18-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,480 kB
  • sloc: ruby: 43,905; sh: 147; xml: 53; javascript: 48; makefile: 26; ml: 1
file content (113 lines) | stat: -rw-r--r-- 5,124 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
From f6dc5befa89642032e16aec0842534a2b31ad7b5 Mon Sep 17 00:00:00 2001
From: Rajesh Simandalahi <rajsimand6@protonmail.com>
Date: Wed, 4 May 2022 17:05:01 +0200
Subject: [PATCH] fix blocks test

---
 test/blocks_test.rb | 83 ---------------------------------------------
 1 file changed, 83 deletions(-)

diff --git a/test/blocks_test.rb b/test/blocks_test.rb
index 663679b..c882c62 100644
--- a/test/blocks_test.rb
+++ b/test/blocks_test.rb
@@ -2462,47 +2462,6 @@ def names
       assert_css 'svg circle', output, 1
     end
 
-    test 'should cache remote SVG when allow-uri-read, cache-uri, and inline option are set' do
-      begin
-        if OpenURI.respond_to? :cache_open_uri
-          OpenURI.singleton_class.send :remove_method, :open_uri
-          OpenURI.singleton_class.send :alias_method, :open_uri, :cache_open_uri
-        end
-        using_test_webserver do |base_url, thr|
-          image_url = %(#{base_url}/fixtures/circle.svg)
-          attributes = { 'allow-uri-read' => '', 'cache-uri' => '' }
-          input = %(image::#{image_url}[Circle,100,100,opts=inline])
-          output = convert_string_to_embedded input, safe: :safe, attributes: attributes
-          assert defined? OpenURI::Cache
-          assert_css 'svg circle', output, 1
-          # NOTE we can't assert here since this is using the system-wide cache
-          #assert_equal thr[:requests].size, 1
-          #assert_equal thr[:requests][0], image_url
-          thr[:requests].clear
-          Dir.mktmpdir do |cache_path|
-            original_cache_path = OpenURI::Cache.cache_path
-            begin
-              OpenURI::Cache.cache_path = cache_path
-              assert_nil OpenURI::Cache.get image_url
-              2.times do
-                output = convert_string_to_embedded input, safe: :safe, attributes: attributes
-                refute_nil OpenURI::Cache.get image_url
-                assert_css 'svg circle', output, 1
-              end
-              assert_equal 1, thr[:requests].size
-              assert_match %r/ \/fixtures\/circle\.svg /, thr[:requests][0], 1
-            ensure
-              OpenURI::Cache.cache_path = original_cache_path
-            end
-          end
-        end
-      ensure
-        OpenURI.singleton_class.send :alias_method, :cache_open_uri, :open_uri
-        OpenURI.singleton_class.send :remove_method, :open_uri
-        OpenURI.singleton_class.send :alias_method, :open_uri, :original_open_uri
-      end
-    end
-
     test 'converts to alt text for SVG with inline option set if SVG cannot be read' do
       input = <<~'EOS'
       [%inline]
@@ -2915,48 +2874,6 @@ def names
       assert_xpath '//img[@src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="][@alt="Dot"]', output, 1
     end
 
-    test 'should cache remote image when allow-uri-read, cache-uri, and data-uri are set' do
-      begin
-        if OpenURI.respond_to? :cache_open_uri
-          OpenURI.singleton_class.send :remove_method, :open_uri
-          OpenURI.singleton_class.send :alias_method, :open_uri, :cache_open_uri
-        end
-        using_test_webserver do |base_url, thr|
-          image_url = %(#{base_url}/fixtures/dot.gif)
-          image_data_uri = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='
-          attributes = { 'allow-uri-read' => '', 'cache-uri' => '', 'data-uri' => '' }
-          input = %(image::#{image_url}[Dot])
-          output = convert_string_to_embedded input, safe: :safe, attributes: attributes
-          assert defined? OpenURI::Cache
-          assert_xpath %(//img[@src="#{image_data_uri}"][@alt="Dot"]), output, 1
-          # NOTE we can't assert here since this is using the system-wide cache
-          #assert_equal thr[:requests].size, 1
-          #assert_equal thr[:requests][0], image_url
-          thr[:requests].clear
-          Dir.mktmpdir do |cache_path|
-            original_cache_path = OpenURI::Cache.cache_path
-            begin
-              OpenURI::Cache.cache_path = cache_path
-              assert_nil OpenURI::Cache.get image_url
-              2.times do
-                output = convert_string_to_embedded input, safe: :safe, attributes: attributes
-                refute_nil OpenURI::Cache.get image_url
-                assert_xpath %(//img[@src="#{image_data_uri}"][@alt="Dot"]), output, 1
-              end
-              assert_equal 1, thr[:requests].size
-              assert_match %r/ \/fixtures\/dot\.gif /, thr[:requests][0], 1
-            ensure
-              OpenURI::Cache.cache_path = original_cache_path
-            end
-          end
-        end
-      ensure
-        OpenURI.singleton_class.send :alias_method, :cache_open_uri, :open_uri
-        OpenURI.singleton_class.send :remove_method, :open_uri
-        OpenURI.singleton_class.send :alias_method, :open_uri, :original_open_uri
-      end
-    end
-
     test 'uses remote image uri when data-uri attribute is set and image cannot be retrieved' do
       image_uri = "http://#{resolve_localhost}:9876/fixtures/missing-image.gif"
       input = <<~EOS
-- 
2.30.2