gokulakrishnansvm commented on code in PR #7400: URL: https://github.com/apache/trafficcontrol/pull/7400#discussion_r1142560872
########## traffic_ops/testing/api_contract/v4/conftest.py: ########## @@ -0,0 +1,103 @@ +"""This module is used to create a Traffic Ops session +and to store prerequisite data for endpoints""" +import json +import logging +import sys +from random import randint +from urllib.parse import urlparse +import pytest +from trafficops.tosession import TOSession +from trafficops.restapi import OperationError + + +# Create and configure logger +logger = logging.getLogger() + + +def pytest_addoption(parser): + """Passing in Traffic Ops Arguments [Username, Password, Url and Hostname] from Command Line""" + parser.addoption( + '--to_user', action='store', help='User name for Traffic Ops Session' + ) + parser.addoption( + '--to_password', action='store', help='Password for Traffic Ops Session' + ) + parser.addoption( + '--to_url', action='store', help='Traffic Ops URL' + ) + + [email protected](name="to_args") +def to_data(pytestconfig): + """PyTest fixture to store Traffic ops Arguments passed from command line""" + args = {} + with open('to_data.json', encoding="utf-8", mode='r') as session_file: + data = json.load(session_file) + session_data = data["test"] + args['api_version'] = session_data.get("api_version") + args['port'] = session_data.get("port") + + to_user = pytestconfig.getoption('--to_user') + to_password = pytestconfig.getoption('--to_password') + to_url = pytestconfig.getoption('--to_url') Review Comment: changed command-line options to hyphen from underscore -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
