File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"$schema" : " http://json-schema.org/draft/2020-12/schema" ,
3
- "$id" : " https://github.com/hic-infra/TODO " ,
3
+ "$id" : " https://github.com/hic-infra/hic-aws-project-cost " ,
4
4
"title" : " AWS project cost configuration" ,
5
5
"type" : " object" ,
6
6
"properties" : {
7
7
"proj-tag-names" : {
8
8
"description" : " A mapping of AWS project tags to the canonical project name" ,
9
9
"type" : " object" ,
10
10
"additionalProperties" : {
11
- "type" : " string"
11
+ "type" : " string" ,
12
+ "minLength" : 1
12
13
}
13
14
},
14
15
"project-groups" : {
17
18
"additionalProperties" : {
18
19
"type" : " array" ,
19
20
"items" : {
20
- "type" : " string"
21
+ "type" : " string" ,
22
+ "minLength" : 1
21
23
}
22
24
}
23
25
},
29
31
"properties" : {
30
32
"name" : {
31
33
"description" : " Name of the AWS account" ,
32
- "type" : " string"
34
+ "type" : " string" ,
35
+ "minLength" : 1
33
36
},
34
37
"billing-type" : {
35
38
"description" : " Whether costs should be split across multiple projects or assigned to a single project" ,
45
48
"type" : " array" ,
46
49
"minItems" : 1 ,
47
50
"items" : {
48
- "type" : " string"
51
+ "type" : " string" ,
52
+ "minLength" : 1
49
53
}
50
54
},
51
55
"project" : {
52
56
"description" : " The project responsible for all costs, required for billing-type=project-specific" ,
53
- "type" : " string"
57
+ "type" : " string" ,
58
+ "minLength" : 1
54
59
}
55
60
},
56
61
"required" : [" name" , " billing-type" ],
Original file line number Diff line number Diff line change 4
4
import yaml
5
5
6
6
from aws_project_costs .project_costs import analyse_costs_csv
7
-
8
- # from aws_project_costs.schema import validate
7
+ from aws_project_costs .schema import validate
9
8
10
9
EXAMPLE_DIR = Path (__file__ ).parent / ".." / "example"
11
10
12
11
12
+ def test_schema_validate ():
13
+ config_yaml = EXAMPLE_DIR / "projects.yaml"
14
+ with (config_yaml ).open () as f :
15
+ cfg = yaml .safe_load (f )
16
+ errors = validate (cfg , raise_on_error = False )
17
+ assert len (errors ) == 0
18
+
19
+
13
20
def test_analyse_costs_csv (tmp_path ):
14
21
config_yaml = EXAMPLE_DIR / "projects.yaml"
15
22
input_csv = EXAMPLE_DIR / "2024-01-01_2024-02-01.csv"
You can’t perform that action at this time.
0 commit comments