85 lines
3.2 KiB
Gherkin
85 lines
3.2 KiB
Gherkin
Feature: Header Loading and Column Detection
|
|
As a developer
|
|
I want _load_headers to handle all edge cases
|
|
So that column detection is robust
|
|
|
|
Scenario: Load headers when sheet is None
|
|
Given a tracker is created but not authenticated
|
|
And sheet attribute is None
|
|
When _load_headers is called internally
|
|
Then it should return early without error
|
|
And headers should remain empty
|
|
And column indices should remain None
|
|
|
|
Scenario: Load headers successfully identifies all columns
|
|
Given an authenticated tracker
|
|
And a sheet with headers "Dataset Name, Status, Error"
|
|
When the tracker loads headers
|
|
Then dataset_name_col should be 0
|
|
And status_col should be 1
|
|
And error_col should be 2
|
|
And headers should contain lowercased column names
|
|
|
|
Scenario: Load headers with alternate column names for dataset
|
|
Given an authenticated tracker
|
|
And a sheet with headers "ID, Status, Error"
|
|
When the tracker loads headers
|
|
Then dataset_name_col should be identified as 0
|
|
And status_col should be 1
|
|
And error_col should be 2
|
|
|
|
Scenario: Load headers with alternate column names for status
|
|
Given an authenticated tracker
|
|
And a sheet with headers "Dataset Name, State, Error"
|
|
When the tracker loads headers
|
|
Then dataset_name_col should be 0
|
|
And status_col should be identified as 1
|
|
And error_col should be 2
|
|
|
|
Scenario: Load headers with alternate column names for error
|
|
Given an authenticated tracker
|
|
And a sheet with headers "Dataset Name, Status, Error Message"
|
|
When the tracker loads headers
|
|
Then dataset_name_col should be 0
|
|
And status_col should be 1
|
|
And error_col should be identified as 2
|
|
|
|
|
|
Scenario: Load headers with case insensitive matching
|
|
Given an authenticated tracker
|
|
And a sheet with headers "DATASET NAME, STATUS, ERROR"
|
|
When the tracker loads headers
|
|
Then all columns should be identified correctly
|
|
And headers should be normalized to lowercase
|
|
|
|
Scenario: Load headers with extra whitespace
|
|
Given an authenticated tracker
|
|
And a sheet with headers " Dataset Name , Status, Error "
|
|
When the tracker loads headers
|
|
Then all columns should be identified correctly after trimming
|
|
|
|
Scenario: Load headers when exception occurs during API call
|
|
Given an authenticated tracker
|
|
And the Google Sheets API raises exception during header fetch
|
|
When the tracker attempts to load headers
|
|
Then it should catch the exception
|
|
And set default column indices (0, 1, 2)
|
|
And headers should be empty list
|
|
|
|
Scenario: Load headers with _find_column_index trying multiple possible names
|
|
Given an authenticated tracker
|
|
And a sheet with headers "dataset_id, processing status, error message"
|
|
When the tracker loads headers using _find_column_index
|
|
Then dataset_name_col should match "dataset_id"
|
|
And status_col should match "processing status"
|
|
And error_col should match "error message"
|
|
|
|
Scenario: Load headers converts all header names to lowercase
|
|
Given an authenticated tracker
|
|
And a sheet with mixed case headers "DaTaSeT NaMe, StAtUs, ErRoR"
|
|
When the tracker loads headers
|
|
Then all headers should be stored in lowercase
|
|
And column matching should work case-insensitively
|
|
|
|
|