def METHOD_NAME(self):
    """
    tokencount test with assign
    test if tokencount policy is working correctly during assign:
    - 5 tokens are enrolled, 4 tokens are allowd in mydefrealm
    - incremential assign the tokens to a user in the mydefrealm
    """
    # all policies are deleted before
    for i in range(1, 6):
        token_params = {"serial": "#TCOUNT%d" % i}
        serial = self.enroll_token(token_params)
        assert serial == "#TCOUNT%d" % i
    # set tokencount policy
    policy = {
        "name": "token_count_policy",
        "scope": "enrollment",
        "action": "tokencount=4, ",
        "user": "*",
        "realm": "mydefrealm",
    }
    response = self.create_policy(policy)
    # check that at least 4 tokens could be assigned
    for i in range(1, 5):
        params = {"serial": "#TCOUNT%d" % i, "user": "def"}
        response = self.make_admin_request("assign", params=params)
        assert '"value": true' in response, response
    # check that the policy will raise an error
    i = 5
    params = {"serial": "#TCOUNT%d" % i, "user": "def"}
    response = self.make_admin_request("assign", params=params)
    assert not ('"value": true' in response), response
    msg = (
        "The maximum allowed number of tokens for the realm 'mydefrealm'"
        " was reached. You can not init any more tokens. Check the "
        "policies scope=enrollment, action=tokencount."
    )
    assert msg in response, response
    # check that overall only 4 tokens belong to user 'def'
    params = {"user": "def"}
    response = self.make_admin_request("show", params=params)
    assert '"tokens": 4,' in response, response
    # now we do an unassign and assign the token #5 to the user:
    # as the token will remain in the realm the new assign has to fail!
    params = {"serial": "#TCOUNT1"}
    response = self.make_admin_request("unassign", params=params)
    assert '"value": true' in response, response
    # check that the policy will raise an error, as there are
    # already 4 tokens in realm
    i = 5
    params = {"serial": "#TCOUNT%d" % i, "user": "def"}
    response = self.make_admin_request("assign", params=params)
    assert not ('"value": true' in response), response
    msg = (
        "The maximum allowed number of tokens for the realm 'mydefrealm'"
        " was reached. You can not init any more tokens. Check the "
        "policies scope=enrollment, action=tokencount."
    )
    assert msg in response, response
    return