Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audience attribute with test case #714

Merged
merged 5 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions schema/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
"additionalProperties": false,
"description": "OWASP schema.",
"properties": {
"audience": {
"description": "The intended audience for the project.",
"enum": ["breaker", "builder", "defender"],
"enumDescriptions": [
"Security testers and ethical hackers.",
"Developers and engineers.",
"Security professionals and defenders."
],
"type": "string"
},
"leaders": {
"description": "Leaders of the project.",
"type": "array",
Expand Down Expand Up @@ -82,6 +92,7 @@
}
},
"required": [
"audience",
"leaders",
"level",
"name",
Expand Down
14 changes: 14 additions & 0 deletions schema/tests/data/project/negative/audience-empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
audience: ""
leaders:
- github: leader-name-1
name: Leader Name 1
- github: leader-name-2
name: Leader Name 2
level: 2
name: OWASP Incubator Code Project
pitch: A very brief, one-line description of your project
tags:
- example-tag-1
- example-tag-2
- example-tag-3
type: code
14 changes: 14 additions & 0 deletions schema/tests/data/project/negative/audience-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
audience: hacker
leaders:
- github: leader-name-1
name: Leader Name 1
- github: leader-name-2
name: Leader Name 2
level: 2
name: OWASP Incubator Code Project
pitch: A very brief, one-line description of your project
tags:
- example-tag-1
- example-tag-2
- example-tag-3
type: code
13 changes: 13 additions & 0 deletions schema/tests/data/project/negative/audience-missing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
leaders:
- github: leader-name-1
name: Leader Name 1
- github: leader-name-2
name: Leader Name 2
level: 2
name: OWASP Incubator Code Project
pitch: A very brief, one-line description of your project
tags:
- example-tag-1
- example-tag-2
- example-tag-3
type: code
1 change: 1 addition & 0 deletions schema/tests/data/project/negative/level-invalid.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
audience: builder
leaders:
- github: leader-name-1
name: Leader Name 1
Expand Down
1 change: 1 addition & 0 deletions schema/tests/data/project/negative/name-empty.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
audience: builder
leaders:
- github: leader-name-1
name: Leader Name 1
Expand Down
1 change: 1 addition & 0 deletions schema/tests/data/project/negative/name-none.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
audience: breaker
leaders:
- github: leader-name-1
name: Leader Name 1
Expand Down
1 change: 1 addition & 0 deletions schema/tests/data/project/positive/code-incubator.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
audience: breaker
leaders:
- github: leader-1-github
name: Leader 1 Name
Expand Down
6 changes: 6 additions & 0 deletions schema/tests/project_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def test_positive(project_schema):
@pytest.mark.parametrize(
("file_path", "error_message"),
[
(
"audience-invalid.yaml",
"'hacker' is not one of ['breaker', 'builder', 'defender']",
),
("audience-empty.yaml", "'' is not one of ['breaker', 'builder', 'defender']"),
("audience-missing.yaml", "'audience' is a required property"),
("level-invalid.yaml", "2.5 is not one of [2, 3, 3.5, 4]"),
("name-empty.yaml", "'' is too short"),
("name-none.yaml", "None is not of type 'string'"),
Expand Down