MCPcopy
hub / github.com/jtesta/ssh-audit / test_policy_create_1

Method test_policy_create_1

test/test_policy.py:298–308  ·  view source on GitHub ↗

Creates a policy from a kex and ensures it is generated exactly as expected.

(self)

Source from the content-addressed store, hash-verified

296
297
298 def test_policy_create_1(self):
299 '''Creates a policy from a kex and ensures it is generated exactly as expected.'''
300
301 kex = self._get_kex()
302 pol_data = self.Policy.create('www.l0l.com', 'bannerX', kex, False)
303
304 # Today's date is embedded in the policy, so filter it out to get repeatable results.
305 pol_data = pol_data.replace(date.today().strftime('%Y/%m/%d'), '[todays date]')
306
307 # Instead of writing out the entire expected policy--line by line--just check that it has the expected hash.
308 assert hashlib.sha256(pol_data.encode('ascii')).hexdigest() == 'fb84bce442cff2bce9bf653d6373a8a938e3bfcfbd1e876f51a08c1842df3cff'
309
310
311 def test_policy_evaluate_passing_1(self):

Callers

nothing calls this directly

Calls 3

_get_kexMethod · 0.95
createMethod · 0.80
sha256Method · 0.80

Tested by

no test coverage detected