Yes it is checking the name of the VM in the azure portal.
If you deployed the ARM template and manually did some changes to the hostname you're in for some fun changes in the azure_ha_test.py and azure_had.py script on the gateways
This is part of the script where it (hardcoded) looks for cluster_name+1 as the name of the first member
if conf['hostname'] not in {cluster_name + '1', cluster_name + '2'}:
Please also check
https://sc1.checkpoint.com/documents/IaaS/WebAdminGuides/EN/CP_CloudGuard_IaaS_HighAvailability_for_...
It explains manual testing without executing the failover
And the important part about the naming convention (because of the hardcoded scripts):
Naming Constraints
Do not change the name of any resources.
Cluster Members VM names must match the Cluster name with a suffix of '1' and '2'.
Network Interface names must match the Cluster Member VM names with a suffix of '-eth0' and '-eth1'.
The IP address of the cluster has to match the configuration file.
By default it should match the cluster name.