Skip to content

Commit

Permalink
make sure code name exists before using it, replace hardcoded ACT_FEA…
Browse files Browse the repository at this point in the history
…TURE_DEFAULT_LIMIT and ACT_FEATURE_CURRENT_EXPECTED_TOTAL
  • Loading branch information
linh2931 committed Aug 3, 2022
1 parent 5c698bb commit 19c0e03
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/plugin_http_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@ def test_ChainApi(self) :
self.activateAllBuiltinProtocolFeatures()
allProtocolFeatures = self.nodeos.getSupportedProtocolFeatures()
allFeatureDigests = [d['feature_digest'] for d in allProtocolFeatures]
allFeatureCodenames = [s['specification'][0]['value'] for s in allProtocolFeatures]
allFeatureCodenames = []
for s in allProtocolFeatures:
if 'specification' in s and len(s['specification']) > 0 and 'name' in s['specification'][0] and s['specification'][0]['name'] == 'builtin_feature_codename':
allFeatureCodenames.append(s['specification'][0]['value'])
self.assertEqual(len(allFeatureDigests), len(allFeatureCodenames))

# Default limit set in get_activated_protocol_features_params
ACT_FEATURE_DEFAULT_LIMIT = 10
ACT_FEATURE_DEFAULT_LIMIT = 10 if len(allFeatureCodenames) > 10 else len(allFeatureCodenames)

# Actual expected activated features total
ACT_FEATURE_CURRENT_EXPECTED_TOTAL = 19
ACT_FEATURE_CURRENT_EXPECTED_TOTAL = len(allFeatureCodenames)

# Extemely high value to attempt to always get full list of activated features
ACT_FEATURE_EXTREME = 10000
Expand Down

0 comments on commit 19c0e03

Please sign in to comment.