Skip to content

Commit 3e8370d

Browse files
authored
allow report permissions, update tests (#172)
* allow report permissions, update tests * flake8
1 parent f753328 commit 3e8370d

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

sfa_api/demo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,4 +617,4 @@ def read_metadata_for_cdf_forecast_values(forecast_id, start):
617617
return (static_cdf_forecast_groups[
618618
static_cdf_forecasts[forecast_id]['parent']
619619
]['interval_length'],
620-
_set_previous_time(start))
620+
_set_previous_time(start))

sfa_api/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ class PermissionPostSchema(ma.Schema):
577577
required=True,
578578
validate=validate.OneOf(['sites', 'aggregates', 'forecasts',
579579
'observations', 'users', 'roles',
580-
'permissions', 'cdf_forecasts']),
580+
'permissions', 'cdf_forecasts', 'reports']),
581581
)
582582
applies_to_all = ma.Boolean(
583583
title="Applies to all",
@@ -709,7 +709,7 @@ class Meta:
709709
string = True
710710
ordered = True
711711
report_id = ma.UUID()
712-
organization = ma.String(title="Organization")
712+
provider = ma.String(title="Provider")
713713
metrics = ma.Dict(
714714
title='Calculated Metrics',
715715
description='Metrics calculated over the '

sfa_api/tests/rbac/test_permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def perm(action, object_type, description, applies_to_all):
5151
(perm('nope', 'roles', 'role perm', True),
5252
'{"action":["Must be one of: create, read, update, delete, read_values, write_values, delete_values, grant, revoke."]}'), # noqa: E501
5353
(perm('create', 'role', 'role perm', True),
54-
'{"object_type":["Must be one of: sites, aggregates, forecasts, observations, users, roles, permissions, cdf_forecasts."]}'), # noqa: E501
54+
'{"object_type":["Must be one of: sites, aggregates, forecasts, observations, users, roles, permissions, cdf_forecasts, reports."]}'), # noqa: E501
5555
(perm('create', 'roles', 'role perm', 5),
5656
'{"applies_to_all":["Not a valid boolean."]}'),
5757
])

sfa_api/tests/test_reports.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ def test_get_report(api, new_report):
4545
res = api.get(f'/reports/{report_id}',
4646
base_url=BASE_URL)
4747
assert res.status_code == 200
48+
report = res.json
49+
assert 'report_id' in report
50+
assert 'provider' in report
51+
assert 'metrics' in report
52+
assert 'raw_report' in report
53+
assert 'status' in report
54+
assert 'created_at' in report
55+
assert 'modified_at' in report
4856

4957

5058
def test_get_report_dne(api, missing_id):

0 commit comments

Comments
 (0)