예제 #1
0
    def test_setting_roles_to_bad_value_raises_type_error(
            self, username, roles, created, expiration, issued_by, token_id,
            not_list):
        token = Token(cid=username,
                      r=roles,
                      cts=created,
                      ets=expiration,
                      rcid=issued_by,
                      tid=token_id)

        with pytest.raises(TypeError):
            token.roles = not_list
예제 #2
0
    def test_setting_roles_to_bad_value_after_init_raises_value_error(
            self, username, roles, created, expiration, issued_by, token_id,
            invalid_roles):
        token = Token(cid=username,
                      r=roles,
                      cts=created,
                      ets=expiration,
                      rcid=issued_by,
                      tid=token_id)

        with pytest.raises(ValueError):
            token.roles = invalid_roles