def test_user_attribuateVoucher_wrong_level(self): user_id = 'test_user_get_id' certification_level = 'test_user_get_level' voucher_code = 'test_user_get_voucher_code' voucher_level = 'test_user_get_voucher_level' voucher_availability = '01/01/2019' #given self.user_table.put_item(Item={'user_id': user_id, 'certification_level': certification_level}) self.voucher_table.put_item(Item={'code': voucher_code, 'certification_level': voucher_level}) user = User(user_id, certification_level) voucher = Voucher(voucher_code, voucher_level, voucher_availability) #when response = user.attribuateVoucher(voucher) #then assert response == False assert user.voucher_code == None
def test_user_attribuateVoucher(self): user_id = 'test_user_get_id' certification_level = 'test_user_get_level' voucher_code = 'test_user_get_voucher_code' voucher_availability = '01/01/2019' #given self.user_table.put_item(Item={'user_id': user_id, 'certification_level': certification_level}) self.voucher_table.put_item(Item={'code': voucher_code, 'certification_level': certification_level}) user = User(user_id, certification_level) voucher = Voucher(voucher_code, certification_level, voucher_availability) #when response = user.attribuateVoucher(voucher) #then assert response == True assert user.voucher_code == voucher_code assert user.attribuated_date == time.strftime('%d/%m/%Y',time.localtime())