Skip to content

Commit

Permalink
Unit tests
Browse files Browse the repository at this point in the history
Unit tests

Unit tests pylint fixes

Unit tests - remove tests for reduceReport
  • Loading branch information
todor-ivanov committed Sep 17, 2024
1 parent fd3cd66 commit 901463d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test/python/WMCore_t/ReqMgr_t/Utils_t/Validation_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import unittest

from WMCore.ReqMgr.DataStructs.RequestError import InvalidSpecParameterValue
from WMCore.ReqMgr.DataStructs.RequestStatus import ACTIVE_STATUS, get_modifiable_properties
from WMCore.ReqMgr.Utils.Validation import (validateOutputDatasets,
validate_request_priority)
validate_request_priority,
_validate_request_allowed_args)
from WMCore.WMSpec.StdSpecs.StdBase import StdBase


class ValidationTests(unittest.TestCase):
Expand Down Expand Up @@ -74,5 +77,27 @@ def testRequestPriorityValidation(self):
validate_request_priority(reqArgs)


def testValidateRequestAllowedArgs(self):
"""
Tests the `_validate_request_allowed_args` functions, which validates two pairs
of request arguments and returns the difference between them and on top of that
applies a filter of allowed parameters changes per status
:return: nothing, raises an exception if there are problems
"""
defReqArgs = StdBase.getWorkloadAssignArgs()
newReqArgs = {key: None for key in defReqArgs.keys()}

for status in ACTIVE_STATUS:
# NOTE: We need to add the RequestStatus artificially and assign it
# to the currently tested active status
defReqArgs["RequestStatus"] = status
expectedReqArgs = {key: None for key in get_modifiable_properties(status)}
reqArgsDiff = _validate_request_allowed_args(defReqArgs, newReqArgs)
print(f"reqArgsDiff: {reqArgsDiff}")
print(f"expectedReqArgs: {expectedReqArgs}")
self.assertDictEqual(reqArgsDiff, expectedReqArgs)
print("===============================")


if __name__ == '__main__':
unittest.main()

0 comments on commit 901463d

Please sign in to comment.