Reduce the complexity of stub_out_db_network_api()

stub_out_db_network_api' is too complex (57)

Running flake8 to check for cyclomatic complexity showed that the test
method stub_out_db_network_api() in the db/fakes.py module had a
complexity of 57. This change refactors the code to reduce that
method's complexity to 2. No functional changes are included.

Change-Id: Ieb77066ba1133eae5c201121d27a970ce040117e
Merge "Reduce the complexity of stub_out_db_network_api()"