def setUp(self): self.time_of_hash = int(time.time()) content_to_hash = "{email}|{expiry}".format(email=signup_information['valid_email'], expiry=self.time_of_hash) self.hash = generate_hmac_hash(self.app.config.get('HMAC_KEY', ''), content_to_hash) content_to_hash = "{email}|{expiry}".format(email=signup_information['existing_user_email'], expiry=self.time_of_hash) self.existing_user_hash = generate_hmac_hash(self.app.config.get('HMAC_KEY', ''), content_to_hash)
def setUp(self): self.time_of_hash = int(time.time()) content_to_hash = f"{signup_information['valid_email']}|{self.time_of_hash}" self.hash = generate_hmac_hash(self.app.config.get('HMAC_KEY', ''), content_to_hash) content_to_hash = f"{signup_information['existing_user_email']}|{self.time_of_hash}" self.existing_user_hash = generate_hmac_hash( self.app.config.get('HMAC_KEY', ''), content_to_hash)
def setUp(self): self.time_of_hash = int(time.time()) content_to_hash = "{email}|{expiry}".format( email=signup_information['valid_email'], expiry=self.time_of_hash) self.hash = generate_hmac_hash(self.app.config.get('HMAC_KEY', ''), content_to_hash) content_to_hash = "{email}|{expiry}".format( email=signup_information['existing_user_email'], expiry=self.time_of_hash) self.existing_user_hash = generate_hmac_hash( self.app.config.get('HMAC_KEY', ''), content_to_hash)
def setUp(self): """Set up hashes for the signup links.""" self.time_of_hash = int(time.time()) # if this test somehow manages to run for more than a year, we probably have bigger problems SECONDS_PER_YEAR = 31_536_000 self.expiry_time = self.time_of_hash + SECONDS_PER_YEAR # time in the past - used to test how we handle expired HMACs self.past_time = self.time_of_hash - 3600 content_to_hash = f"{signup_information['valid_email']}|{self.expiry_time}" self.hash = generate_hmac_hash(self.app.config.get('HMAC_KEY', ''), content_to_hash) content_to_hash = f"{signup_information['existing_user_email']}|{self.time_of_hash}" self.existing_user_hash = generate_hmac_hash( self.app.config.get('HMAC_KEY', ''), content_to_hash) content_to_hash = f"{signup_information['valid_email']}|{self.past_time}" self.expired_hash = generate_hmac_hash( self.app.config.get('HMAC_KEY', ''), content_to_hash)