def test_load_1(self): v = votation_dao.votation_dto() v.votation_description = 'Guar automated test ' + str(random.randint(1,500)) v.votation_type = 'random' v.promoter_user.user_id = 2 v.begin_date = '2018-01-01' v.end_date = '2018-01-15' v.votation_status = 1 votation_dao.insert_votation_dto(v) g = guarantor.guarantor_dto() g.votation_id = v.votation_id g.u.user_id = 1 g.hash_ok = 1 g.passphrase_ok = 0 guarantor.insert_dto(g) g = guarantor.guarantor_dto() g.votation_id = v.votation_id g.u.user_id = 3 g.hash_ok = 0 g.passphrase_ok = 0 guarantor.insert_dto(g) g1 = guarantor.load_guarantor(v.votation_id, g.u.user_id) self.assertEqual(g.votation_id, g1.votation_id) self.assertEqual(g.u.user_id , g1.u.user_id ) self.assertEqual(g.hash_ok , g1.hash_ok ) self.assertEqual(g.passphrase_ok , g1.passphrase_ok )
def be_a_guarantor_confirm(): votation_id = int(request.args.get('votation_id')) v = votation.load_votation_by_id(votation_id) message = "Adesso sei un custode." o = guarantor.guarantor_dto() #app.logger.info(o) o.votation_id = votation_id o.u = current_user.u o.hash_ok = 0 o.passphrase_ok = 0 error = guarantor.validate_dto(o) if error == 0: guarantor.insert_dto(o) else: message = guarantor.error_messages[ error] + ": " + v.votation_description return render_template('be_a_guarantor_confirm_template.html', pagetitle="Guarantor confirm", v=v, message=message)
def test_hash_complete_no_2(self): v = votation_dao.votation_dto() v.votation_description = 'Guar automated test ' + str(random.randint(1,500)) v.votation_type = 'random' v.promoter_user.user_id = 2 v.begin_date = '2018-01-01' v.end_date = '2018-01-15' v.votation_status = 1 votation_dao.insert_votation_dto(v) g = guarantor.guarantor_dto() g.votation_id = v.votation_id g.u.user_id = 1 g.hash_ok = 1 g.passphrase_ok = 0 guarantor.insert_dto(g) g = guarantor.guarantor_dto() g.votation_id = v.votation_id g.u.user_id = 3 g.hash_ok = 0 g.passphrase_ok = 0 guarantor.insert_dto(g) self.assertFalse(guarantor.guarantors_hash_complete(v.votation_id))