def setUp(self): super().setUp() self.currency = GroupCurrencyFactory.create() db.session.add(self.currency) self.user = UserFactory.create() db.session.add(self.user) self.user_another = UserFactory.create() db.session.add(self.user_another) db.session.commit() self.accounts = sorted(AccountFactory.create_batch(30), key=lambda x: x.name) for account in self.accounts: account.currency = self.currency account.user = self.user db.session.add(account) db.session.commit() self.api_app = self.create_api_app(self.user) self.token = self.get_token(self.api_app, self.user) self.api_app_another = self.create_api_app(self.user_another) self.token_another = self.get_token(self.api_app_another, self.user_another)
def setUp(self): super().setUp() self.account = AccountFactory.create() self.target_account = AccountFactory.create() db.session.add(self.account) db.session.add(self.target_account) self.category = GroupCategoryFactory.create() db.session.add(self.category) self.currency = GroupCurrencyFactory.create() db.session.add(self.currency) self.user = UserFactory.create() db.session.add(self.user) self.user1 = UserFactory.create() db.session.add(self.user1) db.session.commit() self.source_account1 = AccountFactory.create() db.session.add(self.source_account1) self.target_account1 = AccountFactory.create() db.session.add(self.target_account1) self.transaction = TransactionFactory( source_account=self.source_account1, target_account=self.target_account1, user=self.user, currency=self.currency ) self.records = sorted(RecordFactory.create_batch(30), key=lambda x: x.date) for record in self.records: record.account = self.account record.category = self.category record.currency = self.currency record.user = self.user db.session.add(record) db.session.commit() self.source_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_EXPENSE, transaction_id=self.transaction.id, user=self.user ) db.session.add(self.source_record1) self.target_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_INCOME, transaction_id=self.transaction.id, user=self.user ) db.session.add(self.target_record1) self.api_app = self.create_api_app(self.user) self.token = self.get_token(self.api_app, self.user) self.api_app1 = self.create_api_app(self.user1) self.token1 = self.get_token(self.api_app1, self.user1)
def setUp(self): super().setUp() self.currency = GroupCurrencyFactory.create() db.session.add(self.currency) self.category = GroupCategoryFactory.create() db.session.add(self.category) self.user = UserFactory.create() db.session.add(self.user) self.user1 = UserFactory.create() db.session.add(self.user1) self.source_account1 = AccountFactory.create(user=self.user) db.session.add(self.source_account1) self.target_account1 = AccountFactory.create(user=self.user) db.session.add(self.target_account1) self.source_account2 = AccountFactory.create(user=self.user) db.session.add(self.source_account2) self.target_account2 = AccountFactory.create(user=self.user) db.session.add(self.target_account2) self.transactions = [ TransactionFactory( source_account=self.source_account1, target_account=self.target_account1, user=self.user, currency=self.currency ), TransactionFactory.create( source_account=self.source_account2, target_account=self.target_account2, user=self.user, currency=self.currency ), ] db.session.commit() self.source_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_EXPENSE, transaction_id=self.transactions[0].id, account=self.source_account1, currency=self.currency, user=self.user ) db.session.add(self.source_record1) self.target_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_INCOME, transaction_id=self.transactions[0].id, account=self.target_account1, currency=self.currency, user=self.user ) db.session.add(self.target_record1) self.source_record2 = RecordFactory.create( record_type=Record.RECORD_TYPE_EXPENSE, transaction_id=self.transactions[1].id, account=self.source_account2, currency=self.currency, user=self.user ) db.session.add(self.source_record2) self.target_record2 = RecordFactory.create( record_type=Record.RECORD_TYPE_INCOME, transaction_id=self.transactions[1].id, account=self.target_account2, currency=self.currency, user=self.user ) db.session.add(self.target_record2) db.session.commit() self.api_app = self.create_api_app(self.user) self.token = self.get_token(self.api_app, self.user) self.api_app1 = self.create_api_app(self.user1) self.token1 = self.get_token(self.api_app1, self.user1)
def setUp(self): super().setUp() self.account = AccountFactory.create() self.target_account = AccountFactory.create() db.session.add(self.account) db.session.add(self.target_account) self.category = GroupCategoryFactory.create() db.session.add(self.category) self.currency = GroupCurrencyFactory.create() db.session.add(self.currency) self.user = UserFactory.create() db.session.add(self.user) self.user1 = UserFactory.create() db.session.add(self.user1) db.session.commit() self.source_account1 = AccountFactory.create() db.session.add(self.source_account1) self.target_account1 = AccountFactory.create() db.session.add(self.target_account1) self.transaction = TransactionFactory( source_account=self.source_account1, target_account=self.target_account1, user=self.user, currency=self.currency) self.records = sorted(RecordFactory.create_batch(30), key=lambda x: x.date) for record in self.records: record.account = self.account record.category = self.category record.currency = self.currency record.user = self.user db.session.add(record) db.session.commit() self.source_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_EXPENSE, transaction_id=self.transaction.id, user=self.user) db.session.add(self.source_record1) self.target_record1 = RecordFactory.create( record_type=Record.RECORD_TYPE_INCOME, transaction_id=self.transaction.id, user=self.user) db.session.add(self.target_record1) self.api_app = self.create_api_app(self.user) self.token = self.get_token(self.api_app, self.user) self.api_app1 = self.create_api_app(self.user1) self.token1 = self.get_token(self.api_app1, self.user1)