-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_basic.py
More file actions
35 lines (27 loc) · 993 Bytes
/
test_basic.py
File metadata and controls
35 lines (27 loc) · 993 Bytes
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
import pytest
from aiohttp.payload import BytesPayload
import aiohttp
import os
def number_sequence():
count = 1
while True:
yield str(count)
count += 1
seq = number_sequence()
url = "http://192.168.0.60:8080"
file_path = "data/test_input.mp3"
async def test_send_music(send_music):
output_file_path = await send_music(url, file_path, next(seq))
assert os.path.exists(output_file_path)
async def test_check_audio(send_music, audio2npArray, compare_audio):
output_file_path = await send_music(url, file_path, next(seq))
np_array1 = audio2npArray(file_path)
np_array2 = audio2npArray(output_file_path)
correlation = compare_audio(np_array1, np_array2)
assert correlation > 85
async def test_service_alive():
async with aiohttp.ClientSession() as session:
async with session.put(f'{url}/v1/imalive', json={'url': 'v1/compress'}) as response:
assert response.status == 200
def test_basic():
assert 1 == 1