Files
dataset-uploader/features/google_sheets_tracker/environment_variables.feature

61 lines
2.8 KiB
Gherkin

Feature: Environment Variable Configuration
As a developer
I want the tracker to work with environment variables
So that configuration is flexible and secure
Background:
Given a temporary credentials directory
Scenario: Create tracker using spreadsheet ID from environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_ID is set
When I create a tracker using create_tracker function without spreadsheet ID
Then the tracker should use spreadsheet ID from environment
And the tracker should authenticate successfully
Scenario: Create tracker using worksheet name from environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_ID is set
And environment variable GOOGLE_SHEETS_WORKSHEET_NAME is set to "CustomSheet"
When I create a tracker using create_tracker function
Then the tracker should use custom worksheet name from environment
And the tracker should authenticate successfully
Scenario: Create tracker with default worksheet name when not in environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_ID is set
And environment variable GOOGLE_SHEETS_WORKSHEET_NAME is not set
When I create a tracker using create_tracker function
Then the tracker should use default worksheet name "Sheet1"
And the tracker should authenticate successfully
Scenario: Create tracker fails when spreadsheet ID not in environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_ID is not set
When I create a tracker using create_tracker function without spreadsheet ID
Then the tracker should be None
Scenario: Create tracker with credentials path from environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_CREDENTIALS_PATH is set
And environment variable GOOGLE_SHEETS_ID is set
When I create a tracker using create_tracker function without credentials path
Then the tracker should use credentials path from environment
And the tracker should authenticate successfully
Scenario: Create tracker prioritizes explicit parameters over environment
Given valid service account credentials
And environment variable GOOGLE_SHEETS_ID is set to "env-spreadsheet-id"
And environment variable GOOGLE_SHEETS_WORKSHEET_NAME is set to "EnvSheet"
When I create a tracker with explicit spreadsheet ID and worksheet name
Then the tracker should use explicit parameters
And not use environment variables
Scenario: Handle exception during tracker creation
Given invalid service account credentials
And environment variable GOOGLE_SHEETS_ID is set
When I create a tracker using create_tracker function
Then the tracker should be None
And no exception should be raised