Files
cleveragents-core/features/project_model.feature

142 lines
6.3 KiB
Gherkin

Feature: Project Domain Model Extensions
As a developer
I want the Project model to support ULID identifiers, namespaces, resources, and configs
So that projects can be properly categorized and managed
# B1.1a - Import Resource, verify Project has new fields
Scenario: Create a Project with new B1.1 fields
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" namespace "local"
Then the project project_id should be "01ARZ3NDEKTSV4RRFFQ69G5FAV"
And the project name should be "my-project"
And the project namespace should be "local"
# B1.1b - Identity fields
Scenario: Project has default namespace
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project namespace should be "local"
Scenario: Project description defaults to none
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project description should be none
Scenario: Create a Project with description
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and description "A test project"
Then the project description should be "A test project"
# B1.1c - Categorization fields
Scenario: Project tags default to empty list
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project tags should be empty
Scenario: Create a Project with tags
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and tags "python,web,api"
Then the project tags should contain "python"
And the project tags should contain "web"
And the project tags should contain "api"
Scenario: Project resources default to empty list
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project resources should be empty
Scenario: Project validation_config defaults to none
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project validation_config should be none
Scenario: Project context_config has defaults
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project context_config should not be none
# B1.1d - Timestamp fields
Scenario: Project has timestamps
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project created_at should be set
And the project updated_at should be set
# B1.1e - is_remote computed property
Scenario: Project with no resources is not remote
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
Then the project is_remote should be false
Scenario: Project with all remote resources is remote
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and all remote resources
Then the project is_remote should be true
Scenario: Project with mixed resources is not remote
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and mixed resources
Then the project is_remote should be false
# B1.1f - Namespace validator
Scenario: Namespace local is valid
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" namespace "local"
Then the project namespace should be "local"
Scenario: Namespace with valid pattern is accepted
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" namespace "team_alpha"
Then the project namespace should be "team_alpha"
Scenario: Namespace system is rejected
When I try to create a Project with namespace "system"
Then a namespace validation error should be raised
Scenario: Namespace with uppercase is rejected
When I try to create a Project with namespace "MyNamespace"
Then a namespace validation error should be raised
Scenario: Namespace starting with number is rejected
When I try to create a Project with namespace "1invalid"
Then a namespace validation error should be raised
# B1.1g - Helper methods
Scenario: namespaced_name returns correct format
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" namespace "team_alpha"
Then the project namespaced_name should be "team_alpha/my-project"
Scenario: namespaced_name with local namespace
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" namespace "local"
Then the project namespaced_name should be "local/my-project"
Scenario: add_resource adds a resource to the project
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
When I add a resource named "my-repo" to the project
Then the project should have 1 resource
And the project should have a resource named "my-repo"
Scenario: remove_resource removes a resource from the project
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and a resource named "my-repo"
When I remove the resource named "my-repo" from the project
Then the project resources should be empty
Scenario: get_resource returns the correct resource
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" name "my-project" and a resource named "my-repo"
When I get the resource named "my-repo" from the project
Then the retrieved resource name should be "my-repo"
Scenario: get_resource returns none for unknown name
Given a Project with project_id "01ARZ3NDEKTSV4RRFFQ69G5FAV" and name "my-project"
When I get the resource named "nonexistent" from the project
Then the retrieved resource should be none
# B1.1h - parse_namespaced_name static method
Scenario: parse_namespaced_name splits valid namespaced string
When I parse the project namespaced name "team_alpha/my-project"
Then the parsed project namespace should be "team_alpha"
And the parsed project name should be "my-project"
Scenario: parse_namespaced_name rejects string without slash
When I try to parse the project namespaced name "no-slash-here"
Then a project namespaced name parse error should be raised
# B1.1i - Name validation edge cases
Scenario: Project rejects name with special characters
When I try to create a Project with invalid name "bad@name!"
Then a name validation error should be raised