示例#1
0
    def test_inactive_actions_url(self):
        """ Test the inactive actions url. """
        api = FakeWekanAPI([FakeBoard([FakeCardList([FakeCard(date_last_activity="2017-1-1T12:00:00.000Z")])])])
        board = WekanBoard('http://wekan', '', '', api=api)

        self.assertEqual([('http://wekan/b/id/title/card_id', 'card_id', '365 dagen')],
                         board.inactive_actions_url('id', now=datetime.datetime(2018, 1, 1, 12, 0, 0)))
 def test_over_due_actions_url_without_over_due_cards(self):
     """ Test the over due actions url without over due cards. """
     api = FakeWekanAPI([
         FakeBoard(
             [FakeCardList([FakeCard(due_at="3017-1-1T12:00:00.000Z")])])
     ])
     board = WekanBoard('http://wekan', '', '', api=api)
     self.assertEqual([],
                      board.over_due_actions_url('id',
                                                 now=datetime.datetime(
                                                     2018, 1, 1, 12, 0, 0)))
 def test_over_due_actions_url(self):
     """ Test the over due actions url. """
     api = FakeWekanAPI([
         FakeBoard(
             [FakeCardList([FakeCard(due_at="2017-1-1T12:00:00.000Z")])])
     ])
     board = WekanBoard('http://wekan', '', '', api=api)
     self.assertEqual(
         [('http://wekan/b/id/title/card_id', 'card_id', '365 dagen')],
         board.over_due_actions_url('id',
                                    now=datetime.datetime(
                                        2018, 1, 1, 12, 0, 0)))
 def test_inactive_actions_without_cards(self):
     """ Test the number of inactive cards when there are none. """
     self.assertEqual(
         0,
         WekanBoard('', '', '',
                    api=FakeWekanAPI([FakeBoard()
                                      ])).nr_of_inactive_actions('id'))
 def test_url(self):
     """ Test the url. """
     self.assertEqual(
         "http://wekan/",
         WekanBoard("http://wekan/",
                    "",
                    "",
                    api=FakeWekanAPI([FakeBoard()])).url())
 def test_get_ignored_lists(self):
     """ Test that the ignored lists can be retrieved. """
     self.assertEqual(["List"],
                      WekanBoard('',
                                 '',
                                 '',
                                 lists_to_ignore=["List"],
                                 api=FakeWekanAPI()).ignored_lists())
 def test_datetime_without_cards(self):
     """ Test the WekanBoard date and time without Wekan board. """
     self.assertEqual(
         datetime.datetime.min,
         WekanBoard('',
                    '',
                    '',
                    api=FakeWekanAPI([FakeBoard([FakeCardList()])
                                      ])).datetime('id'))
 def test_overdue_actions_without_board(self):
     """ Test the number of over due card whe nthere is no board. """
     self.assertEqual(
         -1,
         WekanBoard('',
                    '',
                    '',
                    api=FakeWekanAPI([FakeBoard(id_='other id')
                                      ])).nr_of_over_due_actions('id'))
 def test_inactive_actions_url_without_inactive_cards(self):
     """ Test the inactive actions url without inactive cards. """
     self.assertEqual([],
                      WekanBoard('http://wekan',
                                 '',
                                 '',
                                 api=FakeWekanAPI([
                                     FakeBoard()
                                 ])).inactive_actions_url('id'))
 def test_over_due_actions_with_overdue_cards(self):
     """ Test the number of overdue cards when there is one. """
     api = FakeWekanAPI([
         FakeBoard(
             [FakeCardList([FakeCard(due_at="2017-10-24T15:52:25.249Z")])])
     ])
     self.assertEqual(
         1,
         WekanBoard('', '', '', api=api).nr_of_over_due_actions('id'))
 def test_inactive_actions_with_inactive_cards(self):
     """ Test the number of inactive cards when there is one. """
     api = FakeWekanAPI([
         FakeBoard([
             FakeCardList([FakeCard(created_at="2017-1-24T15:52:25.249Z")])
         ])
     ])
     self.assertEqual(
         1,
         WekanBoard('', '', '', api=api).nr_of_inactive_actions('id'))
 def test_ignore_lists(self):
     """ Test that lists can be ignored. """
     api = FakeWekanAPI([
         FakeBoard([
             FakeCardList(
                 [FakeCard(date_last_activity="2017-1-24T15:52:25.249Z")])
         ])
     ])
     self.assertEqual(
         0,
         WekanBoard('', '', '', lists_to_ignore=["List"],
                    api=api).nr_of_inactive_actions('id'))
 def test_datetime(self):
     """ Test that the WekanBoard date and time equals the most recent card change date and time. """
     api = FakeWekanAPI([
         FakeBoard([
             FakeCardList([
                 FakeCard(date_last_activity="2017-1-24T15:52:25.249Z"),
                 FakeCard(due_at="2017-2-24T15:52:25.249Z")
             ])
         ])
     ])
     self.assertEqual(datetime.datetime(2017, 1, 24, 15, 52, 25, 249000),
                      WekanBoard('', '', '', api=api).datetime('id'))
 def test_inactive_actions_with_start_date_in_the_future(self):
     """ Test that cards with a start date in the future are not inactive. """
     api = FakeWekanAPI([
         FakeBoard([
             FakeCardList([
                 FakeCard(date_last_activity="2017-1-24T15:52:25.249Z",
                          start_at="3000-1-1T12:00:00.000Z")
             ])
         ])
     ])
     self.assertEqual(
         0,
         WekanBoard('', '', '', api=api).nr_of_inactive_actions('id'))
 def test_inactive_actions_with_some_inactive_cards(self):
     """ Test the number of inactive cards when there are some. """
     now = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
     api = FakeWekanAPI([
         FakeBoard([
             FakeCardList([
                 FakeCard(date_last_activity="2017-1-24T15:52:25.249Z"),
                 FakeCard(date_last_activity=now)
             ])
         ])
     ])
     self.assertEqual(
         1,
         WekanBoard('', '', '', api=api).nr_of_inactive_actions('id'))
示例#16
0
 def test_over_due_actions_url_without_over_due_cards(self):
     """ Test the over due actions url without over due cards. """
     api = FakeWekanAPI([FakeBoard([FakeCardList([FakeCard(due_at="3017-1-1T12:00:00.000Z")])])])
     board = WekanBoard('http://wekan', '', '', api=api)
     self.assertEqual([], board.over_due_actions_url('id', now=datetime.datetime(2018, 1, 1, 12, 0, 0)))
 def test_datetime_without_board(self):
     """ Test the WekanBoard date and time without Wekan board. """
     self.assertEqual(
         datetime.datetime.min,
         WekanBoard('', '', '', api=FakeWekanAPI()).datetime('id'))
 def test_api_exception(self):
     """ Test that WekanBoard keeps working when the Wekan API throws an exception. """
     self.assertEqual(
         -1,
         WekanBoard('http://wekan', '', '',
                    api=FakeWekanAPI(throw=True)).nr_of_over_due_actions())
 def test_inactive_actions_url_without_board(self):
     """ Test the inactive actions url. """
     self.assertEqual(
         [],
         WekanBoard('http://wekan', '', '',
                    api=FakeWekanAPI()).inactive_actions_url('id'))
 def test_inactive_actions_without_board(self):
     """ Test the number of inactive card whe nthere is no board. """
     self.assertEqual(
         -1,
         WekanBoard('', '', '',
                    api=FakeWekanAPI()).nr_of_inactive_actions('id'))