Skip to content
Browse files

Check if /list location is actual

  • Loading branch information...
selevit committed Dec 1, 2016
1 parent 648e189 commit e9cfbabf7ce3e2748fad4666222306fbd551eb90
@@ -117,19 +117,52 @@ def test_bot(config: BotConfig) -> bool:
return is_success

def test_bot_list(bot_names: set) -> bool:
url = '{}/list'.format(BASE_URL)
logger.warn("\nTesting if bot list is correct (GET {})\n".format(url))
response = requests.get(url, verify=False, allow_redirects=False)
if response.status_code != 200:
'"200" HTTP status expected, "{}" given'.format(
return False

given_bot_names = set(response.json())
if given_bot_names == bot_names:
return True

if given_bot_names < bot_names:
logger.error("Missing bot names in /list location: {}".format(
', '.join(b for b in (bot_names - given_bot_names))
logger.error("Unexpected bot names in /list location: {}".format(
', '.join(b for b in (given_bot_names - bot_names))
return False

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Test radio-t bots.')
parser.add_argument('project_dir', type=str)
args = parser.parse_args()
bots = find_bots(args.project_dir)
failed_bots = []

is_success = True
for bot in bots.values():
if not test_bot(bot):
is_success = False

if not is_success:
logger.error("\nAll failed bots: {}".format(
', '.join(b.bot_name for b in failed_bots)
logger.error("\nFailed bots: {}".format(
', '.join(b.bot_name for b in failed_jjjjооbots)

is_bot_list_ok = test_bot_list(set(bots.keys()))
if not all([is_success, is_bot_list_ok]):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e9cfbab

Please sign in to comment.
You can’t perform that action at this time.