Skip to content

Commit

Permalink
fix(tests): fix actions, add validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-Becker committed Apr 12, 2024
1 parent d5d002c commit 566742b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 83 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/safety-check.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/tests-merged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Unit Tests (on PR)
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/tests.yaml

This file was deleted.

60 changes: 60 additions & 0 deletions tests/test_validate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,66 @@ def test_validate_config_missing_key():
validate_config(config)


def test_validate_config_layer_mismatch_weights():
config = {
"layers": [
{
"name": "Background",
"values": ["Python Logo", "some other value"],
"trait_path": "./trait-layers/foreground",
"filename": ["logo", "some file"],
"weights": [100],
}
],
"baseURI": ".",
"name": "NFT #",
"description": "This is a description for this NFT series.",
}

with pytest.raises(ConfigValidationError):
validate_config(config)


def test_validate_config_layer_mismatch_filename():
config = {
"layers": [
{
"name": "Background",
"values": ["Python Logo", "some other value"],
"trait_path": "./trait-layers/foreground",
"filename": ["logo"],
"weights": [100, 100],
}
],
"baseURI": ".",
"name": "NFT #",
"description": "This is a description for this NFT series.",
}

with pytest.raises(ConfigValidationError):
validate_config(config)


def test_validate_config_layer_mismatch_values():
config = {
"layers": [
{
"name": "Background",
"values": ["Python Logo"],
"trait_path": "./trait-layers/foreground",
"filename": ["logo", "logo 2"],
"weights": [100, 100],
}
],
"baseURI": ".",
"name": "NFT #",
"description": "This is a description for this NFT series.",
}

with pytest.raises(ConfigValidationError):
validate_config(config)


def test_validate_config_incorrect_type():
config = {
"layers": "should be a list",
Expand Down

0 comments on commit 566742b

Please sign in to comment.