Skip to content

Commit a30d0f4

Browse files
committed
fix: Remove toml example
1 parent d9e210b commit a30d0f4

File tree

2 files changed

+0
-298
lines changed

2 files changed

+0
-298
lines changed

tests/test_unit_tests.py

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,6 @@
4141
ALTERNATIVE_INGREDIENT_TEST_FILE = os.path.join(FIXTURES_DIR, "cloud.jpg")
4242

4343

44-
def load_toml_test_settings_as_json():
45-
"""
46-
Load default trust configuration test settings from a
47-
TOML config file and return its content as JSON-compatible dict.
48-
The return value is used to load settings.
49-
50-
Returns:
51-
dict: The parsed TOML content as a Python dictionary (JSON-compatible).
52-
53-
Raises:
54-
FileNotFoundError: If test_settings.toml is not found.
55-
toml.TomlDecodeError: If the TOML file is malformed.
56-
"""
57-
# Locate the file which contains default settings for tests
58-
tests_dir = os.path.dirname(os.path.abspath(__file__))
59-
settings_path = os.path.join(tests_dir, 'trust_config_test_settings.toml')
60-
61-
# Load the located default test settings
62-
with open(settings_path, 'r') as f:
63-
settings_data = toml.load(f)
64-
65-
return settings_data
66-
6744
def load_test_settings_json():
6845
"""
6946
Load default trust configuration test settings from a
@@ -175,42 +152,6 @@ def test_stream_read_get_validation_state(self):
175152
# Needs trust configuration to be set up to validate as Trusted, otherwise manifest is Invalid
176153
self.assertEqual(validation_state, "Invalid")
177154

178-
def test_stream_read_get_validation_state_with_trust_config_from_toml(self):
179-
# Run in a separate thread to isolate thread-local settings
180-
result = {}
181-
exception = {}
182-
183-
def read_with_trust_config():
184-
try:
185-
# Load trust configuration from test_settings.toml
186-
settings_dict = load_toml_test_settings_as_json()
187-
188-
# Apply the settings (including trust configuration)
189-
# Settings are thread-local, so they won't affect other tests
190-
# And that is why we also run the test in its own thread, so tests are isolated
191-
load_settings(settings_dict)
192-
193-
with open(self.testPath, "rb") as file:
194-
reader = Reader("image/jpeg", file)
195-
validation_state = reader.get_validation_state()
196-
result['validation_state'] = validation_state
197-
except Exception as e:
198-
exception['error'] = e
199-
200-
# Create and start thread
201-
thread = threading.Thread(target=read_with_trust_config)
202-
thread.start()
203-
thread.join()
204-
205-
# Check for exceptions
206-
if 'error' in exception:
207-
raise exception['error']
208-
209-
# Assertions run in main thread
210-
self.assertIsNotNone(result.get('validation_state'))
211-
# With trust configuration loaded, manifest is Trusted
212-
self.assertEqual(result.get('validation_state'), "Trusted")
213-
214155
def test_stream_read_get_validation_state_with_trust_config(self):
215156
# Run in a separate thread to isolate thread-local settings
216157
result = {}

tests/trust_config_test_settings.toml

Lines changed: 0 additions & 239 deletions
This file was deleted.

0 commit comments

Comments
 (0)