def test_wcp_implies_caseinsensitive_returns_false( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, single-name permission, returns False """ p1 = WildcardPermission(wildcardstring1) p2 = WildcardPermission(wildcardstring2) assert not p1.implies(p2)
def test_wcp_implies_caseinsensitive_returns_true( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, single-name permission, returns True """ p1 = WildcardPermission(wildcardstring1) p2 = WildcardPermission(wildcardstring2) assert p1.implies(p2)
def test_wcp_implies_caseinsensitive_wildcards_false( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, wildcard-based permission, retrns False """ p1 = WildcardPermission(wildcard_string=wildcardstring1) p2 = WildcardPermission(wildcard_string=wildcardstring2) assert not p1.implies(p2)
def test_wcp_implies_caseinsensitive_wildcards_false( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, wildcard-based permission, retrns False """ p1 = WildcardPermission(wildcard_string=wildcardstring1) p2 = WildcardPermission(wildcard_string=wildcardstring2) assert not p1.implies(p2)
def test_wcp_equals(): """ unit tested: test case: """ wildcard_string = 'somestring' p1 = WildcardPermission(wildcard_string) p2 = WildcardPermission(wildcard_string) assert p1 == p2
def test_wcp_implies_casesensitive_returns_false( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case sensitive, single-name permission, returns False """ p1 = WildcardPermission(wildcard_string=wildcardstring1, case_sensitive=True) p2 = WildcardPermission(wildcard_string=wildcardstring2, case_sensitive=True) assert not p1.implies(p2)
def test_wcp_implies_caseinsensitive_lists( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, list-based permission, retrns True and the opposite False """ p1 = WildcardPermission(wildcard_string=wildcardstring1) p2 = WildcardPermission(wildcard_string=wildcardstring2) assert p1.implies(p2) and not p2.implies(p1)
def test_wcp_implies_casesensitive_returns_true( wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case sensitive, single-name permission,returns True """ p1 = WildcardPermission(wildcard_string=wildcardstring1, case_sensitive=True) p2 = WildcardPermission(wildcard_string=wildcardstring2, case_sensitive=True) assert p1.implies(p2)
def test_wcp_init_without_wildcard_string(monkeypatch): """ unit tested: __init__ test case: control flow depending on whether a wildcard_string is passed """ with mock.patch.object(WildcardPermission, 'setparts') as wp_sp: wp_sp.return_value = None with pytest.raises(ValueError): wcs = WildcardPermission()
def test_wcp_init_with_wildcard_string(monkeypatch): """ unit tested: __init__ test case: control flow depending on whether a wildcard_string is passed """ with mock.patch.object(WildcardPermission, 'setparts') as wp_sp: wp_sp.return_value = None wcs = WildcardPermission(wildcard_string='DOMAIN:ACTION:INSTANCE') assert wcs.setparts.called
def test_wcp_not_equals_bad_type(): """ unit tested: test case: """ wildcard_string = 'somestring' p1 = WildcardPermission(wildcard_string) othertype = type('OtherPermissionType', (object,), {}) p2 = othertype() assert not p1 == p2
def test_wcp_implies_caseinsensitive_lists(wildcardstring1, wildcardstring2): """ unit tested: implies test case: Case insensitive, list-based permission, retrns True and the opposite False """ p1 = WildcardPermission(wildcard_string=wildcardstring1) p2 = WildcardPermission(wildcard_string=wildcardstring2) assert p1.implies(p2) and not p2.implies(p1)
def default_wildcard_permission(): return WildcardPermission()