IS-04-01 test_05 may incorrectly report successful heartbeats
When performing the bulk of the IS-04-01 tests, various mock registries are enabled and interactions with them recorded. In one case I have observed, when the primary registry is enabled a Node first issued a heartbeat to it and received a 404 code. The Node then registered all of its resources before issuing its next heartbeat. Following this, a further heartbeat was issued, but at the wrong frequency. This should have been caught by `test_05`, but because two heartbeats had already been recorded, the third one happened after the primary registry had been disabled.

The code expects that heartbeats will only be recorded by the mock registry if a Node was already registered, but currently they are recorded whether a Node was registered or not.

This is definitely an edge case, but the failure to catch it makes it much harder to debug the registry failover tests like `test_15` and `test_16`.
diff --git a/nmostesting/mocks/Registry.py b/nmostesting/mocks/Registry.py
index 269ad6e..7cc32c1 100644
--- a/nmostesting/mocks/Registry.py
+++ b/nmostesting/mocks/Registry.py
@@ -175,9 +175,9 @@ def heartbeat(version, node_id):
     registry = REGISTRIES[flask.current_app.config["REGISTRY_INSTANCE"]]
     if not registry.enabled:
         abort(500)
-    # store raw request payload, in order to check for empty request bodies later
-    registry.heartbeat(request.headers, request.data, version, node_id)
     if node_id in registry.get_resources()["node"]:
+        # store raw request payload, in order to check for empty request bodies later
+        registry.heartbeat(request.headers, request.data, version, node_id)
         return jsonify({"health": int(time.time())})
     else:
         abort(404)
['nmostesting/mocks/Registry.py']