Ejemplo n.º 1
0
 def test_domain_to_orm(self):
     obj = domain.Book(
             name='Test Book',
             created_at=self.the_time,
         )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Book)
     assert instance.book_id is None
     assert instance.name == 'Test Book'
     assert instance.created_at == self.the_time
     obj.book_id = 1
     instance = orm.domain_to_orm(obj)
     assert instance.book_id == 1
Ejemplo n.º 2
0
 def test_domain_to_orm(self):
     obj = domain.Book(
         name='Test Book',
         created_at=self.the_time,
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Book)
     assert instance.book_id is None
     assert instance.name == 'Test Book'
     assert instance.created_at == self.the_time
     obj.book_id = 1
     instance = orm.domain_to_orm(obj)
     assert instance.book_id == 1
Ejemplo n.º 3
0
 def test_domain_to_orm(self):
     obj = domain.AccountType(
         account_type='Income',
         sign=True,
         credit_term='income',
         debit_term='expense',
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.AccountType)
     assert instance.account_type == 'Income'
     assert instance.sign is True
     assert instance.credit_term == 'income'
     assert instance.debit_term == 'expense'
Ejemplo n.º 4
0
 def test_domain_to_orm(self):
     obj = domain.Currency(
         cur_code='USD',
         shortcut='$',
         symbol='$',
         long_name='US Dollar',
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Currency)
     assert instance.cur_code == 'USD'
     assert instance.shortcut == '$'
     assert instance.symbol == '$'
     assert instance.long_name == 'US Dollar'
Ejemplo n.º 5
0
 def test_domain_to_orm(self):
     test_date = date(2015, 7, 21)
     test_desc = 'Test Transaction Description'
     obj = domain.Transaction(
         transaction_id=2,
         date=test_date,
         description=test_desc,
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Transaction)
     assert instance.transaction_id == 2
     assert instance.date == test_date
     assert instance.description == test_desc
Ejemplo n.º 6
0
 def test_domain_to_orm(self):
     obj = domain.AccountType(
             account_type='Income',
             sign=True,
             credit_term='income',
             debit_term='expense',
         )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.AccountType)
     assert instance.account_type == 'Income'
     assert instance.sign is True
     assert instance.credit_term == 'income'
     assert instance.debit_term == 'expense'
Ejemplo n.º 7
0
 def test_domain_to_orm(self):
     obj = domain.Currency(
             cur_code='USD',
             shortcut='$',
             symbol='$',
             long_name='US Dollar',
         )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Currency)
     assert instance.cur_code == 'USD'
     assert instance.shortcut == '$'
     assert instance.symbol == '$'
     assert instance.long_name == 'US Dollar'
Ejemplo n.º 8
0
 def test_domain_to_orm(self):
     test_date = date(2015, 7, 21)
     test_desc = 'Test Transaction Description'
     obj = domain.Transaction(
             transaction_id=2,
             date=test_date,
             description=test_desc,
         )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Transaction)
     assert instance.transaction_id == 2
     assert instance.date == test_date
     assert instance.description == test_desc
Ejemplo n.º 9
0
 def test_domain_to_orm(self):
     obj = domain.Split(
         split_id=613,
         number='365',
         description='Split Desc',
         account_id=12,
         status='n',
         amount='18',
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Split)
     assert instance.split_id == 613
     assert instance.number == '365'
     assert instance.description == 'Split Desc'
     assert instance.account_id == 12
     assert instance.status == 'n'
     assert instance.amount == '18'
Ejemplo n.º 10
0
 def test_shallow_domain_to_orm(self):
     obj = domain.Account(
         account_id=10,
         name='Education',
         book=3,
         account_type='Expense',
         currency='USD',
         description='Education Expense',
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Account)
     assert instance.book_id == 3
     assert instance.currency_id == 'USD'
     assert instance.account_type_id == 'Expense'
     assert instance.account_id == 10
     assert instance.name == 'Education'
     assert instance.description == 'Education Expense'
Ejemplo n.º 11
0
 def test_domain_to_orm(self):
     obj = domain.Split(
             split_id=613,
             number='365',
             description='Split Desc',
             account_id=12,
             status='n',
             amount='18',
         )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Split)
     assert instance.split_id == 613
     assert instance.number == '365'
     assert instance.description == 'Split Desc'
     assert instance.account_id == 12
     assert instance.status == 'n'
     assert instance.amount == '18'
Ejemplo n.º 12
0
 def test_shallow_domain_to_orm(self):
     obj = domain.Account(
                 account_id=10,
                 name='Education',
                 book=3,
                 account_type='Expense',
                 currency='USD',
                 description='Education Expense',
             )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Account)
     assert instance.book_id == 3
     assert instance.currency_id == 'USD'
     assert instance.account_type_id == 'Expense'
     assert instance.account_id == 10
     assert instance.name == 'Education'
     assert instance.description == 'Education Expense'
Ejemplo n.º 13
0
 def test_deep_domain_to_orm(self):
     obj = domain.Account(
         account_id=10,
         parent_id=2,
         path='Expense::Education',
         name='Education',
         book=self.book,
         account_type=self.account_type,
         currency=self.currency,
         description='Education Expense',
     )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Account)
     assert instance.book_id == 3
     assert instance.parent_id == 2
     assert instance.currency_id == 'USD'
     assert instance.account_type_id == 'Expense'
     assert instance.account_id == 10
     assert instance.name == 'Education'
     assert instance.path == 'Expense::Education'
     assert instance.description == 'Education Expense'
Ejemplo n.º 14
0
 def test_deep_domain_to_orm(self):
     obj = domain.Account(
                 account_id=10,
                 parent_id=2,
                 path='Expense::Education',
                 name='Education',
                 book=self.book,
                 account_type=self.account_type,
                 currency=self.currency,
                 description='Education Expense',
             )
     instance = orm.domain_to_orm(obj)
     assert isinstance(instance, db.Account)
     assert instance.book_id == 3
     assert instance.parent_id == 2
     assert instance.currency_id == 'USD'
     assert instance.account_type_id == 'Expense'
     assert instance.account_id == 10
     assert instance.name == 'Education'
     assert instance.path == 'Expense::Education'
     assert instance.description == 'Education Expense'