fn single_proposal_should_work_with_delegation_and_vote() {
		with_externalities(&mut new_test_ext(), || {
			System::set_block_number(1);

			assert_ok!(propose_set_balance(1, 2, 1));

			assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
			System::set_block_number(2);
			let r = 0;

			assert_ok!(Democracy::vote(Origin::signed(1), r, AYE));

			// Delegate vote.
			assert_ok!(Democracy::delegate(Origin::signed(2), 1, 100));

			// Vote.
			assert_ok!(Democracy::vote(Origin::signed(2), r, AYE));

			assert_eq!(Democracy::referendum_count(), 1);
			assert_eq!(Democracy::voters_for(r), vec![1, 2]);
			assert_eq!(Democracy::vote_of((r, 1)), AYE);

			// Delegated vote is not counted.
			assert_eq!(Democracy::tally(r), (30, 0, 30));

			assert_eq!(Democracy::end_block(System::block_number()), Ok(()));

			assert_eq!(Balances::free_balance(&42), 2);
		});
	}
/// If transactor voted, delegated vote is overwriten.
If transactor voted, delegated vote is overwriten.
If transactor voted delegated vote is overwriten .
fn single_proposal_should_work_with_delegation_and_vote() {
		with_externalities(&mut new_test_ext(), || {
			System::set_block_number(1);
			assert_ok!(propose_set_balance(1, 2, 1));
			assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
			System::set_block_number(2);
			let r = 0;
			assert_ok!(Democracy::vote(Origin::signed(1), r, AYE));
			// Delegate vote.
			assert_ok!(Democracy::delegate(Origin::signed(2), 1, 100));
			// Vote.
			assert_ok!(Democracy::vote(Origin::signed(2), r, AYE));
			assert_eq!(Democracy::referendum_count(), 1);
			assert_eq!(Democracy::voters_for(r), vec![1, 2]);
			assert_eq!(Democracy::vote_of((r, 1)), AYE);
			// Delegated vote is not counted.
			assert_eq!(Democracy::tally(r), (30, 0, 30));
			assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
			assert_eq!(Balances::free_balance(&42), 2);
		});
	}
fn single_proposal_should_work_with_delegation_and_vote ( ) { with_externalities ( & mut new_test_ext ( ) , | | { System :: set_block_number ( 1 ) ; assert_ok ! ( propose_set_balance ( 1 2 1 ) ) ; assert_eq ! ( Democracy end_block ( System block_number ( ) ) Ok ( ( ) ) ) ; System :: set_block_number ( 2 ) ; let r = 0 ; assert_ok ! ( Democracy vote ( Origin signed ( 1 ) r AYE ) ) ; // Delegate vote. assert_ok ! ( Democracy delegate ( Origin signed ( 2 ) 1 100 ) ) ; // Vote. assert_ok ! ( Democracy vote ( Origin signed ( 2 ) r AYE ) ) ; assert_eq ! ( Democracy referendum_count ( ) 1 ) ; assert_eq ! ( Democracy voters_for ( r ) vec [ 1 2 ] ) ; assert_eq ! ( Democracy vote_of ( ( r 1 ) ) AYE ) ; // Delegated vote is not counted. assert_eq ! ( Democracy tally ( r ) ( 30 0 30 ) ) ; assert_eq ! ( Democracy end_block ( System block_number ( ) ) Ok ( ( ) ) ) ; assert_eq ! ( Balances free_balance ( 42 ) 2 ) ; } ) ; }
If transactor voted, delegated vote is overwriten.
If transactor voted delegated vote is overwriten .