Make API name validation failure deterministic

Makes the testing of a valid name in the API deterministic
with respect to failing when an empty name is supplied
by the user. Formerly it could fail either of two constraints
- must be at least one character long
- does not match the valid regexp which requires one character

The lack of deterministic behaviour was causing issues with
some unittests when PYTHONHASHSEED is not set to 0 because
of the two failure modes. The second constraint for validation
of names is now modified so it allows empty strings but overall the
behaviour remains the same because of the first constraint.

Change-Id: Iea89bb329a8939af5168926717b5c13bdf2a7f62
Partial-Bug: 1350287
Merge "Make API name validation failure deterministic"