File: pass-Content-Type-explicitly.patch

package info (click to toggle)
schleuder 5.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,352 kB
  • sloc: ruby: 12,100; sh: 230; makefile: 10
file content (128 lines) | stat: -rw-r--r-- 5,572 bytes parent folder | download | duplicates (2)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
From 8b545114ded9b7c6ecaa2af9e1fc00c9b8b17dff Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Fri, 31 Jan 2025 17:27:39 +0100
Subject: [PATCH] spec/schleuder-api-daemon: pass Content-Type explicit with
 POST requests

These tests have been failing currently in Debian. This may be caused by
either rack 3 or Sinatra 4, not sure which.
---
 spec/schleuder-api-daemon/requests/keys_spec.rb        | 10 +++++-----
 spec/schleuder-api-daemon/requests/list_spec.rb        |  2 +-
 .../schleuder-api-daemon/requests/subscription_spec.rb | 10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/spec/schleuder-api-daemon/requests/keys_spec.rb b/spec/schleuder-api-daemon/requests/keys_spec.rb
index 56beae1..34f1339 100644
--- a/spec/schleuder-api-daemon/requests/keys_spec.rb
+++ b/spec/schleuder-api-daemon/requests/keys_spec.rb
@@ -58,7 +58,7 @@ describe 'keys via api' do
     it 'doesn\'t import keys without authentication' do
       parameters = {'list_id' => @list.id, 'keymaterial' => File.read('spec/fixtures/bla_foo_key.txt') }
       expect {
-        post '/keys.json', parameters.to_json
+        post '/keys.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
         expect(last_response.status).to be 401
       }.to change{ @list.keys.length }.by 0
     end
@@ -67,7 +67,7 @@ describe 'keys via api' do
       authorize!
       parameters = {'list_id' => @list.id, 'keymaterial' => File.read('spec/fixtures/bla_foo_key.txt') }
       expect {
-        post '/keys.json', parameters.to_json
+        post '/keys.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
         expect(last_response.status).to be 200
       }.to change{ @list.keys.length }.by 1
       @list.delete_key('0xEBDBE899251F2412')
@@ -77,7 +77,7 @@ describe 'keys via api' do
       authorize!
       keymaterial = [File.read('spec/fixtures/expired_key.txt'), File.read('spec/fixtures/bla_foo_key.txt')].join("\n")
       parameters = {'list_id' => @list.id, 'keymaterial' => keymaterial}
-      post '/keys.json', parameters.to_json
+      post '/keys.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
       result = JSON.parse(last_response.body)
 
       expect(result).to be_a(Hash)
@@ -102,7 +102,7 @@ describe 'keys via api' do
     it 'returns json with empty array in case of useless input' do
       authorize!
       parameters = {'list_id' => @list.id, 'keymaterial' => 'something something'}
-      post '/keys.json', parameters.to_json
+      post '/keys.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
       result = JSON.parse(last_response.body)
 
       expect(result).to be_a(Hash)
@@ -165,7 +165,7 @@ describe 'keys via api' do
       authorize!
       parameters = {'list_id' => @list.id, 'keymaterial' => File.read('spec/fixtures/broken_utf8_uid_key.txt') }
       expect {
-        post '/keys.json', parameters.to_json
+        post '/keys.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
         expect(last_response.status).to be 200
       }.to change{ @list.keys.length }.by(1)
     end
diff --git a/spec/schleuder-api-daemon/requests/list_spec.rb b/spec/schleuder-api-daemon/requests/list_spec.rb
index 37fc583..cff33aa 100644
--- a/spec/schleuder-api-daemon/requests/list_spec.rb
+++ b/spec/schleuder-api-daemon/requests/list_spec.rb
@@ -9,7 +9,7 @@ describe 'lists via api' do
       fingerprint: list.fingerprint
     }
     expect {
-      post '/lists.json', parameters.to_json
+      post '/lists.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
       expect(last_response.status).to be 200
     }.to change { List.count }.by 1
   end
diff --git a/spec/schleuder-api-daemon/requests/subscription_spec.rb b/spec/schleuder-api-daemon/requests/subscription_spec.rb
index 5467ce9..cf9d505 100644
--- a/spec/schleuder-api-daemon/requests/subscription_spec.rb
+++ b/spec/schleuder-api-daemon/requests/subscription_spec.rb
@@ -12,7 +12,7 @@ describe 'subscription via api' do
 
     expect(@list.subscriptions.size).to be(0)
 
-    post '/subscriptions.json', parameters.to_json
+    post '/subscriptions.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
 
     expect(last_response.status).to be 401
     expect(@list.reload.subscriptions.size).to be(0)
@@ -24,7 +24,7 @@ describe 'subscription via api' do
 
     expect(@list.subscriptions.size).to be(0)
 
-    post '/subscriptions.json', parameters.to_json
+    post '/subscriptions.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
     @list.reload
 
     expect(last_response.status).to be 201
@@ -39,7 +39,7 @@ describe 'subscription via api' do
 
     expect(@list.subscriptions.size).to be(0)
 
-    post '/subscriptions.json', parameters.to_json
+    post '/subscriptions.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
     @list.reload
 
     expect(last_response.status).to be 201
@@ -54,7 +54,7 @@ describe 'subscription via api' do
 
     expect(@list.subscriptions.size).to be(0)
 
-    post '/subscriptions.json', parameters.to_json
+    post '/subscriptions.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
     @list.reload
 
     expect(last_response.status).to be 201
@@ -69,7 +69,7 @@ describe 'subscription via api' do
 
     expect(@list.subscriptions.size).to be(0)
 
-    post '/subscriptions.json', parameters.to_json
+    post '/subscriptions.json', parameters.to_json, 'CONTENT_TYPE' => 'application/json'
     @list.reload
 
     expect(last_response.status).to be 201
-- 
2.47.2