Skip to content

Commit 1ecbbe0

Browse files
Fixed Config reader issue by adding relative path
1 parent bde7af1 commit 1ecbbe0

File tree

2 files changed

+23
-51
lines changed

2 files changed

+23
-51
lines changed

logs/restful_booker_api.log

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2025-01-14 00:33:17,178 : INFO : --- Test Case 1 ---
2+
2025-01-14 00:33:17,178 : INFO : --- GET - all booking ids ---
3+
2025-01-14 00:33:18,028 : INFO : Test execution completed
4+
2025-01-14 00:33:18,030 : INFO : --- Test Case 2 ---
5+
2025-01-14 00:33:18,030 : INFO : --- GET - booking by id ---
6+
2025-01-14 00:33:20,179 : INFO : Test execution completed
7+
2025-01-14 00:33:20,181 : INFO : --- Test Case 4 ---
8+
2025-01-14 00:33:20,181 : INFO : --- GET - Validate Get Booking By ID JSON Schema ---
9+
2025-01-14 00:33:22,029 : INFO : Test execution completed
10+
2025-01-14 00:33:22,031 : INFO : --- Test Case 3 ---
11+
2025-01-14 00:33:22,031 : INFO : --- POST : Create Booking ---
12+
2025-01-14 00:33:22,894 : INFO : Test execution completed
13+
2025-01-14 00:33:22,897 : INFO : --- Test Case 5 ---
14+
2025-01-14 00:33:22,897 : INFO : --- PUT: Update Booking ---
15+
2025-01-14 00:33:24,787 : INFO : Test execution completed
16+
2025-01-14 00:33:24,789 : INFO : --- Test Case 6 ---
17+
2025-01-14 00:33:24,789 : INFO : --- PATCH: Partial Update Booking ---
18+
2025-01-14 00:33:26,527 : INFO : Test execution completed
19+
2025-01-14 00:33:26,529 : INFO : --- Test Case 6 ---
20+
2025-01-14 00:33:26,529 : INFO : --- DELETE: Delete Booking ---
21+
2025-01-14 00:33:28,275 : INFO : Test execution completed

utilities/read_properties.py

+2-51
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,12 @@
11
import configparser
2-
# import os
32

43
config =configparser.ConfigParser()
5-
# config.read("configurations/config.ini")
6-
config.read(r"C:\Users\pfarakate\OneDrive - Infor\Frameworks\Demo_Framework\api-automation-framework-python\configurations\config.ini")
7-
# config_path = os.path.join(os.path.dirname(__file__), "configurations/config.ini")
8-
# config.read(config_path)
4+
config.read("configurations/config.ini")
5+
96

107
class ReadConfig:
118
@staticmethod
129
def get_base_url():
1310
return config.get("restfulBooker", "base_url")
1411

1512

16-
# import os
17-
# import configparser
18-
#
19-
# class ReadConfig:
20-
# @staticmethod
21-
# def get_base_url():
22-
# config = configparser.ConfigParser()
23-
# # Dynamically get the absolute path of config.ini
24-
# config_path = os.path.join(os.path.dirname(__file__), '../config.ini')
25-
# if not os.path.exists(config_path):
26-
# raise FileNotFoundError(f"Configuration file not found at {config_path}")
27-
# config.read(config_path)
28-
# if "restfulBooker" not in config:
29-
# raise KeyError(f"'restfulBooker' section not found in {config_path}")
30-
# return config.get("restfulBooker", "base_url")
31-
32-
# import os
33-
# import configparser
34-
#
35-
#
36-
# class ReadConfig:
37-
# @staticmethod
38-
# def get_base_url():
39-
# config = configparser.ConfigParser()
40-
#
41-
# # Dynamically get the absolute path of config.ini
42-
# config_path = os.path.join(os.path.dirname(__file__), '../config.ini')
43-
#
44-
# # Check if the config file exists
45-
# if not os.path.exists(config_path):
46-
# raise FileNotFoundError(f"Configuration file not found at {config_path}")
47-
#
48-
# # Read the config file
49-
# config.read(config_path)
50-
#
51-
# # Verify the section exists
52-
# if "restfulBooker" not in config:
53-
# raise KeyError(f"'restfulBooker' section not found in {config_path}")
54-
#
55-
# # Get the base_url value
56-
# try:
57-
# base_url = config.get("restfulBooker", "base_url")
58-
# except configparser.NoOptionError:
59-
# raise KeyError(f"'base_url' option not found in 'restfulBooker' section of {config_path}")
60-
#
61-
# return base_url

0 commit comments

Comments
 (0)