def test_oa_policy_function_basics(self): # considered Open Access test_rights = {'NC': False, 'SA': False, 'ND': False} assert oa_policy.oa_from_rights(**test_rights) # NOT considered Open Access # note the following iterates over a COPY of test_rights # since the loop modifies test_rights and sets the values to True one # by one, achieving the effect of # {'SA': True, 'NC': False, 'ND': False} # {'SA': False, 'NC': True, 'ND': False} # {'SA': False, 'NC': False, 'ND': True} # It then does exactly the same, but with the value None. # True means there is a restriction. None is for licenses which have # unknown NC or other rights they grant/deny. test_values = [True, None] for tv in test_values: for right, right_value in test_rights.copy().items(): # So set every right/requirement to True or None, see if the # function returns False as expected, and then reset that right, # ready for testing the next right. test_rights[right] = tv assert not oa_policy.oa_from_rights(**test_rights) test_rights[right] = False assert oa_policy.oa_from_rights(**test_rights)
def test_oa_policy_function_additional_args(self): # considered Open Access test_rights = {'NC': False, 'SA': False, 'ND': False, 'BY': True } assert oa_policy.oa_from_rights(**test_rights)