Skip to content

Commit

Permalink
Added tests for ceda_platform and ncas_platform functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-hampton committed Feb 22, 2024
1 parent d6f8312 commit f8f800f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,25 @@ def test_longitude():
assert crf.longitude('200.0000', {}, label='Test') == ["Test '200.0000' must be within -180 and +180 "]


def test_ceda_platform():
# Test function returns no errors for all NCAS platforms
for plat in ["bt-tower-t35", "cao", "cao-sparsholt", "cdao", "cdao-frongoch", "cvao", "faam", "iao", "wao"]:
assert crf.ceda_platform(plat, {}) == []
# Test function returns no errors for a non-NCAS platform
assert crf.ceda_platform("netheravon", {}) == []
# Test function returns error for example platform
assert crf.ceda_platform("example", {}, label='Test') == ["Test 'example' is not a valid platform in the CEDA catalogue"]


def test_ncas_platform():
# Test function returns no errors for all NCAS platforms
for plat in ["bt-tower-t35", "cao", "cao-sparsholt", "cdao", "cdao-frongoch", "cvao", "faam", "iao", "wao"]:
assert crf.ncas_platform(plat, {}) == []
# Test function returns error for a non-NCAS platform
assert crf.ncas_platform("netheravon", {}, label='Test') == ["Test 'netheravon' is not a valid NCAS platform"]
# Test function returns error for example platform
assert crf.ncas_platform("example", {}, label='Test') == ["Test 'example' is not a valid NCAS platform"]

# rules.py
def _test_type(_type, value):
return r.check(f"type-rule:{_type}", value)
Expand Down

0 comments on commit f8f800f

Please sign in to comment.