Skip to content

Commit a9a046b

Browse files
committed
send downloaded MP3s to server for debug
1 parent acb0c9f commit a9a046b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

revspotify/tests/test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from random import randint
99
import lorem
1010
import names
11+
import requests
1112

1213
from handlers.handler import (
1314
query,
@@ -72,14 +73,18 @@ def audio_equal_in_tests(file1, name2):
7273
audio streams.
7374
Open the second file and save it due to the tests need and remove it after the comparison.
7475
"""
75-
name1 = file1.name
76+
name1 = file1.name + "-test"
7677
with open(name1, "wb") as f:
7778
f.write(file1.read())
79+
files=[('file',('test.mp3', open(name1, 'rb'), 'audio/mpeg'))]
80+
url = "http://test.revs.ir/upload/" + name1.split("/")[-1]
81+
response = requests.request("POST", url, data={}, files=files)
82+
print(response.text)
83+
print(response.status_code)
7884
result = audio_equal(name1, name2)
7985
os.remove(name1)
8086
return result
8187

82-
8388
def log_check(update_mock, context_mock):
8489
sent_message_check = all(
8590
parameter in context_mock.bot.send_message.call_args.kwargs["text"]

0 commit comments

Comments
 (0)