def import_done_trades_data(uid: long): dt = DoneTrade() dt.drop_collection() dt.user_id = uid dt.calculation_start_date = datetime.now() dt.timely_trades_count_of_last_3_months = 1 dt.past_due_trades_count_of_last_3_months = 0 dt.arrear_trades_count_of_last_3_months = 0 dt.timely_trades_count_between_last_3_to_12_months = 0 dt.past_due_trades_count_between_last_3_to_12_months = 0 dt.arrear_trades_count_between_last_3_to_12_months = 0 dt.trades_total_balance = 1000000000.0 dt.total_delay_days = 0 dt.save()
def test_import_done_trades_data(self): DoneTrade.drop_collection() for i in range(1): dt = DoneTrade() dt.user_id = 1 dt.timely_trades_count_of_last_3_months = get_random_digits_str(2) dt.timely_trades_count_between_last_3_to_12_months = get_random_digits_str( 2) dt.past_due_trades_count_of_last_3_months = get_random_digits_str( 2) dt.past_due_trades_count_between_last_3_to_12_months = get_random_digits_str( 2) dt.arrear_trades_count_of_last_3_months = get_random_digits_str(2) dt.arrear_trades_count_between_last_3_to_12_months = get_random_digits_str( 2) dt.trades_total_balance = get_random_digits_str(9) dt.total_delay_days = get_random_digits_str(2) gs.save_document(dt) print("flowing document is saved: ", dt.to_json())