Creates a policy from a kex and ensures it is generated exactly as expected.
(self)
| 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): |