# Path: endpoints/API_Interface.py
# class API_Interface(Base_API,Cars_API_Endpoints,Registration_API_Endpoints,User_API_Endpoints):
# 	"A composed interface for the API objects"
# 
# 	def __init__(self, url, session_flag=False):
# 		"Constructor"
# 		# make base_url available to all API endpoints
# 		self.request_obj = requests
# 		if session_flag:
# 			self.create_session()
# 		self.base_url = url
# 
# 	def create_session(self):
# 		"Create a session object"
# 		self.request_obj = requests.Session()
# 
# 		return self.request_obj
# 
# Path: utils/results.py
# class Results(object):
#     """ Base class for logging intermediate test outcomes """
# 
#     def __init__(self, level=logging.DEBUG, log_file_path=None):
#         self.logger = Base_Logging(log_file_name=log_file_path, level=level)
#         self.total = 0  # Increment whenever success or failure are called
#         self.passed = 0  # Increment everytime success is called
#         self.written = 0  # Increment when conditional_write is called
#         # Increment when conditional_write is called with True
#         self.written_passed = 0
#         self.failure_message_list = []
# 
# 
#     def assert_results(self):
#         """ Check if the test passed or failed """
#         assert self.passed == self.total
# 
# 
#     def write(self, msg, level='info'):
#         """ This method use the logging method """
#         self.logger.write(msg, level)
# 
# 
#     def conditional_write(self, condition, positive, negative, level='info', pre_format="  - "):
#         """ Write out either the positive or the negative message based on flag """
#         if condition:
#             self.write(pre_format + positive, level)
#             self.written_passed += 1
#         else:
#             self.write(pre_format + negative, level)
#         self.written += 1
# 
# 
#     def log_result(self, flag, positive, negative, level='info'):
#         """ Write out the result of the test """
#         if flag is True:
#             self.success(positive, level=level)
#         if flag is False:
#             self.failure(negative, level=level)
#             raise Exception
#         self.write('~~~~~~~~\n', level)
# 
# 
#     def success(self, msg, level='info', pre_format='PASS: '):
#         """ Write out a success message """
#         self.logger.write(pre_format + msg, level)
#         self.total += 1
#         self.passed += 1
# 
# 
#     def failure(self, msg, level='info', pre_format='FAIL: '):
#         """ Write out a failure message """
#         self.logger.write(pre_format + msg, level)
#         self.total += 1
#         self.failure_message_list.append(pre_format + msg)
# 
# 
#     def get_failure_message_list(self):
#         """ Return the failure message list """
# 
#         return self.failure_message_list
# 
# 
#     def write_test_summary(self):
#         """ Print out a useful, human readable summary """
#         self.write('\n************************\n--------RESULT--------\nTotal number of checks=%d' % self.total)
#         self.write('Total number of checks passed=%d\n----------------------\n************************\n\n' % self.passed)
#         self.write('Total number of mini-checks=%d' % self.written)
#         self.write('Total number of mini-checks passed=%d' % self.written_passed)
#         failure_message_list = self.get_failure_message_list()
#         if len(failure_message_list) > 0:
#             self.write('\n--------FAILURE SUMMARY--------\n')
#             for msg in failure_message_list:
#                 self.write(msg)
# 
# Path: conf/api_example_conf.py

# 
# Path: utils/interactive_mode.py
# def display_gui_test_options(browser,browser_version,os_version,
#                              os_name,remote_flag,testrail_flag,tesults_flag):
# def set_default_flag_gui(browser,browser_version,os_version,os_name,
#                          remote_flag,testrail_flag,tesults_flag):
# def get_user_response_gui():
# def ask_questions_gui(browser,browser_version,os_version,os_name,remote_flag,
#                       testrail_flag,tesults_flag):
# def ask_questions_mobile(mobile_os_name, mobile_os_version, device_name, app_package,
#                          app_activity, remote_flag, device_flag, testrail_flag, tesults_flag,
#                          app_name, app_path):
# def get_user_response_mobile():
# def ask_questions_api(api_url,session_flag=True):
# def get_user_response_api():
# def get_testrailflag_status():
# def get_tesultsflag_status():
# def set_remote_credentials():
# def get_remote_flag_status():
# def get_browser_version(browser):
# def get_os_version(os_name):
# def get_os_name(remote_flag):
# def gui_default_options():
# def  mobile_display_options(mobile_os_name, mobile_os_version, device_name,
#                             app_package, app_activity, remote_flag, device_flag,
#                             testrail_flag, tesults_flag, app_name,app_path):
# def mobile_android_devices(mobile_os_version):
# def mobile_ios_devices(mobile_os_version):
# def mobile_default_options():
# def get_mobile_os_name():
# def get_mobile_os_version(mobile_os_name):
# def get_sessionflag_status():
# def get_api_url():


from base64 import b64encode
from .API_Interface import API_Interface
from utils.results import Results
from conf import api_example_conf as conf
from utils import interactive_mode
from _pytest import python
from _pytest import config
import urllib.parse
import logging
import pytest
"""
API_Player class does the following:
a) serves as an interface between the test and API_Interface
b) contains several useful wrappers around commonly used combination of actions
c) maintains the test context/state
"""

# Path: endpoints/API_Interface.py
# class API_Interface(Base_API,Cars_API_Endpoints,Registration_API_Endpoints,User_API_Endpoints):
# 	"A composed interface for the API objects"
# 
# 	def __init__(self, url, session_flag=False):
# 		"Constructor"
# 		# make base_url available to all API endpoints
# 		self.request_obj = requests
# 		if session_flag:
# 			self.create_session()
# 		self.base_url = url
# 
# 	def create_session(self):
# 		"Create a session object"
# 		self.request_obj = requests.Session()
# 
# 		return self.request_obj
# 
# Path: utils/results.py
# class Results(object):
#     """ Base class for logging intermediate test outcomes """
# 
#     def __init__(self, level=logging.DEBUG, log_file_path=None):
#         self.logger = Base_Logging(log_file_name=log_file_path, level=level)
#         self.total = 0  # Increment whenever success or failure are called
#         self.passed = 0  # Increment everytime success is called
#         self.written = 0  # Increment when conditional_write is called
#         # Increment when conditional_write is called with True
#         self.written_passed = 0
#         self.failure_message_list = []
# 
# 
#     def assert_results(self):
#         """ Check if the test passed or failed """
#         assert self.passed == self.total
# 
# 
#     def write(self, msg, level='info'):
#         """ This method use the logging method """
#         self.logger.write(msg, level)
# 
# 
#     def conditional_write(self, condition, positive, negative, level='info', pre_format="  - "):
#         """ Write out either the positive or the negative message based on flag """
#         if condition:
#             self.write(pre_format + positive, level)
#             self.written_passed += 1
#         else:
#             self.write(pre_format + negative, level)
#         self.written += 1
# 
# 
#     def log_result(self, flag, positive, negative, level='info'):
#         """ Write out the result of the test """
#         if flag is True:
#             self.success(positive, level=level)
#         if flag is False:
#             self.failure(negative, level=level)
#             raise Exception
#         self.write('~~~~~~~~\n', level)
# 
# 
#     def success(self, msg, level='info', pre_format='PASS: '):
#         """ Write out a success message """
#         self.logger.write(pre_format + msg, level)
#         self.total += 1
#         self.passed += 1
# 
# 
#     def failure(self, msg, level='info', pre_format='FAIL: '):
#         """ Write out a failure message """
#         self.logger.write(pre_format + msg, level)
#         self.total += 1
#         self.failure_message_list.append(pre_format + msg)
# 
# 
#     def get_failure_message_list(self):
#         """ Return the failure message list """
# 
#         return self.failure_message_list
# 
# 
#     def write_test_summary(self):
#         """ Print out a useful, human readable summary """
#         self.write('\n************************\n--------RESULT--------\nTotal number of checks=%d' % self.total)
#         self.write('Total number of checks passed=%d\n----------------------\n************************\n\n' % self.passed)
#         self.write('Total number of mini-checks=%d' % self.written)
#         self.write('Total number of mini-checks passed=%d' % self.written_passed)
#         failure_message_list = self.get_failure_message_list()
#         if len(failure_message_list) > 0:
#             self.write('\n--------FAILURE SUMMARY--------\n')
#             for msg in failure_message_list:
#                 self.write(msg)
# 
# Path: conf/api_example_conf.py

# 
# Path: utils/interactive_mode.py
# def display_gui_test_options(browser,browser_version,os_version,
#                              os_name,remote_flag,testrail_flag,tesults_flag):
# def set_default_flag_gui(browser,browser_version,os_version,os_name,
#                          remote_flag,testrail_flag,tesults_flag):
# def get_user_response_gui():
# def ask_questions_gui(browser,browser_version,os_version,os_name,remote_flag,
#                       testrail_flag,tesults_flag):
# def ask_questions_mobile(mobile_os_name, mobile_os_version, device_name, app_package,
#                          app_activity, remote_flag, device_flag, testrail_flag, tesults_flag,
#                          app_name, app_path):
# def get_user_response_mobile():
# def ask_questions_api(api_url,session_flag=True):
# def get_user_response_api():
# def get_testrailflag_status():
# def get_tesultsflag_status():
# def set_remote_credentials():
# def get_remote_flag_status():
# def get_browser_version(browser):
# def get_os_version(os_name):
# def get_os_name(remote_flag):
# def gui_default_options():
# def  mobile_display_options(mobile_os_name, mobile_os_version, device_name,
#                             app_package, app_activity, remote_flag, device_flag,
#                             testrail_flag, tesults_flag, app_name,app_path):
# def mobile_android_devices(mobile_os_version):
# def mobile_ios_devices(mobile_os_version):
# def mobile_default_options():
# def get_mobile_os_name():
# def get_mobile_os_version(mobile_os_name):
# def get_sessionflag_status():
# def get_api_url():


# Path: endpoints/API_Player.py
from base64 import b64encode
from .API_Interface import API_Interface
from utils.results import Results
from conf import api_example_conf as conf
from utils import interactive_mode
from _pytest import python
from _pytest import config
import urllib.parse
import logging
import pytest

"""
API_Player class does the following:
a) serves as an interface between the test and API_Interface
b) contains several useful wrappers around commonly used combination of actions
c) maintains the test context/state
"""

from conf import api_example_conf as conf