Spaces:
Paused
Paused
| import os | |
| from dotenv import dotenv_values | |
| from fastapi import FastAPI | |
| from pymongo import MongoClient | |
| from main import requests | |
| import uuid | |
| import pytest | |
| from dotenv import load_dotenv | |
| import requests | |
| import json | |
| # Test Fuzzy Search Integrated component on existing call records | |
| def test_search_pass(): | |
| # Test against records with mention of 'Football' | |
| response = requests.get("http://127.0.0.1:8080/call/fuzzy-search/ozpHhyum3sayTdxIKUAtF51uvWJ2/football") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 3 # three matching call transcripts | |
| # Test Fuzzy Search Integrated component on existing call records | |
| def test_search_pass2(): | |
| # Test against records with mention of 'Football' mispelled as 'Footbll' | |
| response = requests.get("http://127.0.0.1:8080/call/fuzzy-search/ozpHhyum3sayTdxIKUAtF51uvWJ2/footbll") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 3 # still three matching call transcripts | |
| # Test Fuzzy Search Integrated component on existing call records | |
| def test_search_fail(): | |
| # Test against records with mention of 'Football | |
| response = requests.get("http://127.0.0.1:8080/call/fuzzy-search/ozpHhyum3sayTdxIKUAtF51uvWJ2/basketball") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 0 # no matching call transcripts | |
| # Test Summarisation Integrated component on existing call records | |
| def test_summary_pass(): | |
| # Test with summarisation of english version transcript | |
| response = requests.get("http://127.0.0.1:8080//call/summarise/FCnORXmLkw48G5mgscBV/ozpHhyum3sayTdxIKUAtF51uvWJ2/eng") | |
| assert response.status_code == 200 | |
| def test_summary_pass2(): | |
| # Test with summarisation of polish version transcript | |
| response = requests.get("http://127.0.0.1:8080//call/summarise/FCnORXmLkw48G5mgscBV/fNGMkWoSK7fxwE3tbp8E816sthd2/pol") | |
| assert response.status_code == 200 | |
| def test_summary_fail(): | |
| # Test with summarisation of english version transcript | |
| response = requests.get("http://127.0.0.1:8080//call/summarise/falseID/ozpHhyum3sayTdxIKUAtF51uvWJ2/eng") # non exising call record | |
| assert response.status_code == 404 | |
| def test_summary_fail2(): | |
| # Test with summarisation of english version transcript | |
| response = requests.get("http://127.0.0.1:8080//call/summarise/FCnORXmLkw48G5mgscBV/falseID/eng") # non exising user record | |
| assert response.status_code == 404 | |
| # Test Key Key Extraction Integrated component on existing call records | |
| def test_extraction_pass(): | |
| # Test against records with mention of 'Football' | |
| response = requests.get("http://127.0.0.1:8080//call/term-extraction/FCnORXmLkw48G5mgscBV/ozpHhyum3sayTdxIKUAtF51uvWJ2/eng") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 3 # still three matching call transcripts | |
| # Test Fuzzy Search Integrated component on existing call records | |
| def test_extracion_pass2(): | |
| # Test against records with mention of 'Football' mispelled as 'Footbll' | |
| response = requests.get("http://127.0.0.1:8080//call/term-extraction/FCnORXmLkw48G5mgscBV/fNGMkWoSK7fxwE3tbp8E816sthd2/pol") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 3 # still three matching call transcripts | |
| # Test Fuzzy Search Integrated component on existing call records | |
| def test_extraction_fail(): | |
| # Test against records with mention of 'Football | |
| response = requests.get("http://127.0.0.1:8080//call/term-extraction/FCnORXmLkw48G5mgscBV/ozpHhyum3sayTdxIKUAtF51uvWJ2/eng") | |
| assert response.status_code == 200 | |
| assert len(response.json()) == 0 # no matching call transcripts |