Пример #1
0
    def test_view_has_page_info(self):
        """ The posting by account view should have page info """

        posting_view5 = postviews.PostingByAccountView(self.kas_account)
        self.assertEqual(posting_view5.page, 1, 'Wrong or no view page')
        self.assertEqual(posting_view5.pagelength, 25,
                         'Wrong or no view pagelength')
        self.assertEqual(posting_view5.total_pages, 2,
                         'Wrong or no number of pages')
Пример #2
0
    def test_view_has_posting_info(self):
        """ The view dict contains the info for postings """

        posting_view4 = postviews.PostingByAccountView(self.kas_account)
        self.assertIn('amount',
                      posting_view4.as_dict()['postings'][0],
                      'No posting info')
        self.assertIn('debcred',
                      posting_view4.as_dict()['postings'][0],
                      'No debit/credit')
        self.assertIn('postmonth',
                      posting_view4.as_dict()['postings'][0],
                      'No posting month')
Пример #3
0
    def test_view_has_page_2(self):
        """ We can access the second page of postings """

        posting_view6 = postviews.PostingByAccountView(self.kas_account,
                                                       page=2)
        self.assertEqual(posting_view6.page, 2, 'Wrong or no view page')
Пример #4
0
    def test_as_dict_has_account_info(self):
        """ The created dictionary from the view holds account info """

        posting_view3 = postviews.PostingByAccountView(self.kas_account)
        self.assertIn('name', posting_view3.as_dict(), 'No account name')
Пример #5
0
    def test_postings_in_view(self):
        """ Postings are added to a view """

        posting_view2 = postviews.PostingByAccountView(self.kas_account)
        self.assertEqual(len(posting_view2.postings), 25,
                         'Wrong number of postings')
Пример #6
0
    def test_can_create_view(self):
        """ We can create a posting by account view """

        posting_view1 = postviews.PostingByAccountView(self.kas_account)
        self.assertEqual(posting_view1.account, self.kas_account,
                         'No account in view')