|
@@ -1,5 +1,8 @@
|
|
|
#![cfg(test)]
|
|
|
-
|
|
|
+use crate::tests::fixtures::{
|
|
|
+ create_default_member_owned_channel_with_video, create_initial_storage_buckets_helper,
|
|
|
+ increase_account_balance_helper,
|
|
|
+};
|
|
|
use crate::tests::mock::*;
|
|
|
use crate::*;
|
|
|
use frame_support::{assert_err, assert_ok};
|
|
@@ -13,12 +16,14 @@ fn make_bid() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -29,8 +34,8 @@ fn make_bid() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -43,11 +48,11 @@ fn make_bid() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make nft auction bid
|
|
|
assert_ok!(Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -62,8 +67,12 @@ fn make_bid() {
|
|
|
auction.starts_at = current_block;
|
|
|
}
|
|
|
|
|
|
- let (auction, _, _) =
|
|
|
- auction.make_bid(SECOND_MEMBER_ID, SECOND_MEMBER_ORIGIN, bid, current_block);
|
|
|
+ let (auction, _, _) = auction.make_bid(
|
|
|
+ SECOND_MEMBER_ID,
|
|
|
+ SECOND_MEMBER_ACCOUNT_ID,
|
|
|
+ bid,
|
|
|
+ current_block,
|
|
|
+ );
|
|
|
|
|
|
// Ensure nft status changed to given Auction
|
|
|
assert!(matches!(
|
|
@@ -74,15 +83,16 @@ fn make_bid() {
|
|
|
}) if auction == auction_with_bid
|
|
|
));
|
|
|
|
|
|
- let auction_bid_made_event = get_test_event(RawEvent::AuctionBidMade(
|
|
|
- SECOND_MEMBER_ID,
|
|
|
- video_id,
|
|
|
- bid,
|
|
|
- false,
|
|
|
- ));
|
|
|
-
|
|
|
// Last event checked
|
|
|
- assert_event(auction_bid_made_event, number_of_events_before_call + 4);
|
|
|
+ assert_event(
|
|
|
+ MetaEvent::content(RawEvent::AuctionBidMade(
|
|
|
+ SECOND_MEMBER_ID,
|
|
|
+ video_id,
|
|
|
+ bid,
|
|
|
+ false,
|
|
|
+ )),
|
|
|
+ number_of_events_before_call + 4,
|
|
|
+ );
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -94,12 +104,14 @@ fn make_bid_completes_auction() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -121,8 +133,8 @@ fn make_bid_completes_auction() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -135,11 +147,11 @@ fn make_bid_completes_auction() {
|
|
|
// deposit initial balance
|
|
|
let bid = 2 * Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make nft auction bid
|
|
|
assert_ok!(Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -157,13 +169,14 @@ fn make_bid_completes_auction() {
|
|
|
}) if owner == NFTOwner::Member(SECOND_MEMBER_ID)
|
|
|
));
|
|
|
|
|
|
- let nft_auction_started_event = get_test_event(RawEvent::BidMadeCompletingAuction(
|
|
|
- SECOND_MEMBER_ID,
|
|
|
- video_id,
|
|
|
- ));
|
|
|
-
|
|
|
// Last event checked
|
|
|
- assert_event(nft_auction_started_event, number_of_events_before_call + 5);
|
|
|
+ assert_event(
|
|
|
+ MetaEvent::content(RawEvent::BidMadeCompletingAuction(
|
|
|
+ SECOND_MEMBER_ID,
|
|
|
+ video_id,
|
|
|
+ )),
|
|
|
+ number_of_events_before_call + 3,
|
|
|
+ );
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -175,12 +188,14 @@ fn make_bid_auth_failed() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -191,8 +206,8 @@ fn make_bid_auth_failed() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -200,12 +215,12 @@ fn make_bid_auth_failed() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make an attempt to make auction bid providing wrong credentials
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(UNKNOWN_ORIGIN),
|
|
|
- SECOND_MEMBER_ID,
|
|
|
+ Origin::signed(UNAUTHORIZED_MEMBER_ACCOUNT_ID),
|
|
|
+ DEFAULT_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
|
);
|
|
@@ -223,12 +238,14 @@ fn make_bid_insufficient_balance() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -239,8 +256,8 @@ fn make_bid_insufficient_balance() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -249,7 +266,7 @@ fn make_bid_insufficient_balance() {
|
|
|
|
|
|
// Make an attempt to make auction bid if account has insufficient balance
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -271,11 +288,11 @@ fn make_bid_video_does_not_exist() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if corresponding video does not exist
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -294,16 +311,18 @@ fn make_bid_nft_is_not_issued() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if corresponding nft is not issued yet
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -322,12 +341,14 @@ fn make_bid_nft_is_not_in_auction_state() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -337,11 +358,11 @@ fn make_bid_nft_is_not_in_auction_state() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if corresponding nft is not in auction state
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -360,12 +381,14 @@ fn make_bid_nft_auction_expired() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -386,8 +409,8 @@ fn make_bid_nft_auction_expired() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -398,11 +421,11 @@ fn make_bid_nft_auction_expired() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, 2 * bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, 2 * bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if corresponding english nft auction is already expired
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -421,12 +444,14 @@ fn make_bid_nft_auction_is_not_started() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -448,17 +473,18 @@ fn make_bid_nft_auction_is_not_started() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, starting_price);
|
|
|
+ let _ =
|
|
|
+ balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, starting_price);
|
|
|
|
|
|
// Make an attempt to make auction bid if auction is not started
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
starting_price,
|
|
@@ -477,12 +503,14 @@ fn make_bid_member_is_not_allowed_to_participate() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -497,13 +525,15 @@ fn make_bid_member_is_not_allowed_to_participate() {
|
|
|
}),
|
|
|
minimal_bid_step: Content::min_bid_step(),
|
|
|
starts_at: Some(<frame_system::Module<Test>>::block_number() + 1),
|
|
|
- whitelist: BTreeSet::from_iter(vec![THIRD_MEMBER_ID, FOURTH_MEMBER_ID].into_iter()),
|
|
|
+ whitelist: BTreeSet::from_iter(
|
|
|
+ vec![COLLABORATOR_MEMBER_ID, DEFAULT_MODERATOR_ID].into_iter(),
|
|
|
+ ),
|
|
|
};
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
@@ -514,11 +544,11 @@ fn make_bid_member_is_not_allowed_to_participate() {
|
|
|
// deposit initial balance
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, 2 * bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, 2 * bid);
|
|
|
|
|
|
// Make an attempt to make auction bid on auction with whitelist if member is not whitelisted
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -540,12 +570,14 @@ fn make_bid_starting_price_constraint_violated() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -565,19 +597,19 @@ fn make_bid_starting_price_constraint_violated() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
|
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if bid amount provided is less then auction starting price
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -599,12 +631,14 @@ fn make_bid_bid_step_constraint_violated() {
|
|
|
|
|
|
let video_id = NextVideoId::<Test>::get();
|
|
|
|
|
|
- create_simple_channel_and_video(FIRST_MEMBER_ORIGIN, FIRST_MEMBER_ID);
|
|
|
+ create_initial_storage_buckets_helper();
|
|
|
+ increase_account_balance_helper(DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
|
|
|
+ create_default_member_owned_channel_with_video();
|
|
|
|
|
|
// Issue nft
|
|
|
assert_ok!(Content::issue_nft(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
None,
|
|
|
b"metablob".to_vec(),
|
|
@@ -624,19 +658,19 @@ fn make_bid_bid_step_constraint_violated() {
|
|
|
|
|
|
// Start nft auction
|
|
|
assert_ok!(Content::start_nft_auction(
|
|
|
- Origin::signed(FIRST_MEMBER_ORIGIN),
|
|
|
- ContentActor::Member(FIRST_MEMBER_ID),
|
|
|
+ Origin::signed(DEFAULT_MEMBER_ACCOUNT_ID),
|
|
|
+ ContentActor::Member(DEFAULT_MEMBER_ID),
|
|
|
video_id,
|
|
|
auction_params.clone(),
|
|
|
));
|
|
|
|
|
|
let bid = Content::min_starting_price();
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, bid);
|
|
|
|
|
|
// Make a successfull bid
|
|
|
assert_ok!(Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
bid,
|
|
@@ -644,11 +678,11 @@ fn make_bid_bid_step_constraint_violated() {
|
|
|
|
|
|
let new_bid = bid + Content::min_bid_step() - 1;
|
|
|
|
|
|
- let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ORIGIN, new_bid);
|
|
|
+ let _ = balances::Module::<Test>::deposit_creating(&SECOND_MEMBER_ACCOUNT_ID, new_bid);
|
|
|
|
|
|
// Make an attempt to make auction bid if bid step constraint violated
|
|
|
let make_bid_result = Content::make_bid(
|
|
|
- Origin::signed(SECOND_MEMBER_ORIGIN),
|
|
|
+ Origin::signed(SECOND_MEMBER_ACCOUNT_ID),
|
|
|
SECOND_MEMBER_ID,
|
|
|
video_id,
|
|
|
new_bid,
|