def test_input_updater(self): input_params = {"p1": "v1", "p2": "v2"} updated_input = Nonce.update_nonce(input_params) self.assertIn("nonce", updated_input) nonce = str(Nonce()) input_params.update({"nonce": nonce}) updated_input = Nonce.update_nonce(input_params) self.assertIn("nonce", updated_input) self.assertEqual(nonce, updated_input["nonce"])
def test_nonce_generator(self): nonce_list = [] for i in range(0, 100): nonce_list.append(str(Nonce())) for nonce in nonce_list: self.assertTrue(len(nonce) > 0) self.assertTrue(len(nonce) <= 128) self.assertEqual(nonce_list.count(nonce), 1)