示例#1
0
            while period + datetime.timedelta(hours=1) < start:
                period = period + datetime.timedelta(hours=1)

            pre_test_start_date = period
            test_start_date = pre_test_start_date
            pre_test_start_date = test_start_date - datetime.timedelta(
                seconds=2)
            test_start_date_iso = test_utils.date_to_iso(test_start_date)
            pre_test_start_date_iso = test_utils.date_to_iso(
                pre_test_start_date)

            test_end_date = test_start_date + datetime.timedelta(days=3)
            test_end_date_iso = test_utils.date_to_iso(test_end_date)

            # list proposals with inactive status, it shoud be list of pairs id:total_votes
            votes = test_utils.list_proposals(node_client, test_start_date_iso,
                                              "inactive")
            for vote in votes:
                #should be 0 for all
                assert vote == 0, "All votes should be equal to 0"

            logger.info("Balances for accounts after creating proposals")
            balances = test_utils.print_balance(node_client, accounts)
            for balance in balances:
                #should be 390.000 TBD for all
                assert balance == '390000', "All balances should be equal to 390.000 TBD"
            test_utils.print_balance(node_client, [{'name': args.treasury}])

            # move forward in time to see if proposals are paid
            # moving is made in 1h increments at a time, after each
            # increment balance is printed and checked
            logger.info("Moving to date: {}".format(test_start_date_iso))
示例#2
0
                    'daily_pay': pd[3]
                }
                proposals.append(proposal)

            import datetime
            test_start_date = now + datetime.timedelta(days=1)
            test_start_date_iso = test_utils.date_to_iso(test_start_date)

            test_end_date = test_start_date + datetime.timedelta(days=4,
                                                                 hours=1)
            test_end_date_iso = test_utils.date_to_iso(test_end_date)

            test_utils.create_proposals(node_client, proposals)

            # list proposals with inactive status, it shoud be list of pairs id:total_votes
            test_utils.list_proposals(node_client, test_start_date_iso,
                                      "inactive")

            # each account is voting on proposal
            test_utils.vote_proposals(node_client, accounts)

            # list proposals with inactive status, it shoud be list of pairs id:total_votes
            votes = test_utils.list_proposals(node_client, test_start_date_iso,
                                              "inactive")
            for vote in votes:
                #should be 0 for all
                assert vote == 0, "All votes should be equal to 0"

            logger.info("Balances for accounts after creating proposals")
            balances = test_utils.print_balance(node_client, accounts)
            for balance in balances:
                #should be 390.000 TBD for all
            for pd in proposal_data:
                start_date, end_date = test_utils.get_start_and_end_date(now, pd[1], pd[2])
                proposal = {'creator' : pd[0], 'receiver' : pd[0], 'start_date' : start_date, 'end_date' : end_date, 'daily_pay' : pd[3]}
                proposals.append(proposal)

            import datetime
            test_start_date = now + datetime.timedelta(days = 1)
            test_start_date_iso = test_utils.date_to_iso(test_start_date)

            test_end_date = test_start_date + datetime.timedelta(days = 6, hours = 1)
            test_end_date_iso = test_utils.date_to_iso(test_end_date)

            test_utils.create_proposals(node_client, proposals)

            # list proposals with inactive status, it shoud be list of pairs id:total_votes
            test_utils.list_proposals(node_client, test_start_date_iso, "inactive")

            # each account is voting on proposal
            test_utils.vote_proposals(node_client, accounts)

            # list proposals with inactive status, it shoud be list of pairs id:total_votes
            votes = test_utils.list_proposals(node_client, test_start_date_iso, "inactive")
            for vote in votes:
                #should be 0 for all
                assert vote == 0, "All votes should be equal to 0"

            logger.info("Balances for accounts after creating proposals")
            balances = test_utils.print_balance(node_client, accounts)
            for balance in balances:
                #should be 390.000 TBD for all
                assert balance == '390.000 TBD', "All balances should be equal to 390.000 TBD"