mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-14 14:22:18 +03:00
scripts/testing: Remove per-scenario scripts
The required functionality is now all in `test-sender.py`.
This commit is contained in:
parent
ad8fc57df3
commit
00071ba7e9
@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
#
|
|
||||||
# 2022-01-10: THIS SCRIPT DOES NOT PERFORM THE INTENDED PURPOSE
|
|
||||||
# BECAUSE IT SEEMS THAT `requests` (or underlying modules) IS TOO CLEVER
|
|
||||||
# AND APPLIES COMPRESSION WHEN WE SET THE `Content-Encoding: gzip`
|
|
||||||
# HEADER
|
|
||||||
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
import sys
|
|
||||||
|
|
||||||
print('''
|
|
||||||
DO NOT USE THIS SCRIPT, IT DOES NOT PERFORM THE INTENDED PURPOSE.
|
|
||||||
|
|
||||||
USE THE `test-bad-gzip.sh` SCRIPT INSTEAD.
|
|
||||||
|
|
||||||
''')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
s = requests.Session()
|
|
||||||
|
|
||||||
# This apparently causes compression to actually happen
|
|
||||||
s.headers['Content-Encoding'] = 'gzip'
|
|
||||||
r = s.post(
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
data=msg,
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r!r}')
|
|
||||||
print(f'Body: {r.content.decode()}')
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# python `requests` appears to perform compression when you set the
|
|
||||||
# 'Content-Encoding: gzip' header, so do this with curl.
|
|
||||||
|
|
||||||
curl --verbose -d 'wegiuweuygtfawgep9aqe8fpq2387lfbr;iufvypq38764tpgf' -H 'Content-Encoding: gzip' 'https://dev.eddn.edcd.io:4432/upload/'
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
import sys
|
|
||||||
import urllib3
|
|
||||||
import zlib
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
# Read from provided file
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
# Fake form-encode it
|
|
||||||
msg = 'wibble=' + msg
|
|
||||||
|
|
||||||
# Compress it
|
|
||||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
|
||||||
|
|
||||||
# Send that compressed data as a POST body
|
|
||||||
r = http.request(
|
|
||||||
'POST',
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
headers={
|
|
||||||
'Content-Encoding': 'gzip'
|
|
||||||
},
|
|
||||||
body=msg_gzip
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r.status!r}')
|
|
||||||
print(f'Body:\n{r.data.decode()}\n')
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
import sys
|
|
||||||
import urllib3
|
|
||||||
import zlib
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
# Read from provided file
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
# Fake form-encode it
|
|
||||||
msg = 'data=' + msg
|
|
||||||
|
|
||||||
# Compress it
|
|
||||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
|
||||||
|
|
||||||
# Send that compressed data as a POST body
|
|
||||||
r = http.request(
|
|
||||||
'POST',
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
headers={
|
|
||||||
'Content-Encoding': 'gzip'
|
|
||||||
},
|
|
||||||
body=msg_gzip
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r.status!r}')
|
|
||||||
print(f'Body:\n{r.data.decode()}\n')
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
import sys
|
|
||||||
import urllib3
|
|
||||||
import zlib
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
# Read from provided file
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
# Compress it
|
|
||||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
|
||||||
|
|
||||||
# Send that compressed data as a POST body
|
|
||||||
r = http.request(
|
|
||||||
'POST',
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
headers={
|
|
||||||
'Content-Encoding': 'gzip'
|
|
||||||
},
|
|
||||||
body=msg_gzip
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r.status!r}')
|
|
||||||
print(f'Body:\n{r.data.decode()}\n')
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
# Read from provided file
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
# Fake form-encode it
|
|
||||||
msg = 'wibble=' + msg
|
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
|
||||||
|
|
||||||
# Send that data as a POST body
|
|
||||||
r = http.request(
|
|
||||||
'POST',
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
body=msg
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r.status!r}')
|
|
||||||
print(f'Body:\n{r.data.decode()}\n')
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print('test-sender.py <filename>')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
with open(sys.argv[1], 'r') as f:
|
|
||||||
# Read from provided file
|
|
||||||
msg = f.read()
|
|
||||||
|
|
||||||
# Fake form-encode it
|
|
||||||
msg = 'data=' + msg
|
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
|
||||||
|
|
||||||
# Send that data as a POST body
|
|
||||||
r = http.request(
|
|
||||||
'POST',
|
|
||||||
'https://dev.eddn.edcd.io:4432/upload/',
|
|
||||||
body=msg
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f'Response: {r.status!r}')
|
|
||||||
print(f'Body:\n{r.data.decode()}\n')
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user