Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions libraries/botbuilder-ai/tests/qna/test_qna.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# pylint: disable=protected-access
# pylint: disable=too-many-lines

import json
import requests
import unittest
from os import path
from typing import List, Dict
import unittest
from unittest.mock import patch

import json
import requests
from aiohttp import ClientSession

import aiounittest
Expand Down Expand Up @@ -171,9 +172,7 @@ async def test_returns_answer_using_requests_module(self):
response_path: str = "ReturnsAnswer.json"
response_json = QnaApplicationTest._get_json_for_file(response_path)

qna = QnAMaker(
endpoint=QnaApplicationTest.tests_endpoint, http_client=requests
)
qna = QnAMaker(endpoint=QnaApplicationTest.tests_endpoint, http_client=requests)
context = QnaApplicationTest._get_context(question, TestAdapter())

with patch("requests.post", return_value=response_json):
Expand All @@ -185,7 +184,7 @@ async def test_returns_answer_using_requests_module(self):
self.assertEqual(
"BaseCamp: You can use a damp rag to clean around the Power Pack",
answers[0].answer,
)
)

async def test_returns_answer_using_options(self):
# Arrange
Expand Down Expand Up @@ -287,7 +286,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):
context=None,
qna_id=None,
is_test=False,
ranker_type="Default"
ranker_type="Default",
)
response_path = "ReturnsAnswer.json"
response_json = QnaApplicationTest._get_json_for_file(response_path)
Expand All @@ -296,10 +295,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):

with patch("requests.post", return_value=response_json):
result = await http_request_helper.execute_http_request(
url,
question,
QnaApplicationTest.tests_endpoint,
timeout=None
url, question, QnaApplicationTest.tests_endpoint, timeout=None
)
answers = result["answers"]

Expand All @@ -308,7 +304,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):
self.assertEqual(
"BaseCamp: You can use a damp rag to clean around the Power Pack",
answers[0]["answer"],
)
)

async def test_telemetry_returns_answer(self):
# Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ async def validate_claims(
await auth_config.claims_validator(claims)
elif SkillValidation.is_skill_claim(claims):
# Skill claims must be validated using AuthenticationConfiguration claims_validator
raise PermissionError("Unauthorized Access. Request is not authorized. Skill Claims require validation.")
raise PermissionError(
"Unauthorized Access. Request is not authorized. Skill Claims require validation."
)

@staticmethod
def is_government(channel_service: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion pipelines/botbuilder-python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
pip install -r ./libraries/botbuilder-ai/tests/requirements.txt
pip install coveralls
pip install pylint==2.4.4
pip install black
pip install black==19.10b0
displayName: 'Install dependencies'

- script: |
Expand Down