コード例 #1
0
 def test_pagination(self):
     thread = PublicSerializer(instance=ThreadFactory(public=True))
     ThreadFactory.create_batch(settings.REST_FRAMEWORK['PAGE_SIZE'],
                                public=True)
     resp = self.client.get(reverse('messaging_public_threads'), {
         'page': 2,
         'offset': 100,
         'limit': 100
     })
     self.assertEqual(thread.data, resp.data['results'][0])
コード例 #2
0
 def setUp(self):
     mod = ModeratorFactory.create_mod()
     self.client.force_login(mod)
     self.board = BoardFactory()
     self.board2 = BoardFactory()
     self.threads = ThreadFactory.create_batch(5,
                                               reported=True,
                                               board=self.board)
     self.threads2 = ThreadFactory.create_batch(5,
                                                reported=True,
                                                board=self.board2)
     self.resp_get_all = self.client.get(
         reverse('dj-mod:moderation_thread_report_list'))
     self.resp_get_board = self.client.get('{}?board={}'.format(
         reverse('dj-mod:moderation_thread_report_list'), self.board.slug))
コード例 #3
0
ファイル: test_views.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     self.board = BoardFactory()
     self.threads = ThreadFactory.create_batch(5,
                                               board=self.board,
                                               archived=True)
     self.not_archived = ThreadFactory(board=self.board, archived=False)
     self.resp = self.client.get(self.board.get_archive_url())
コード例 #4
0
ファイル: test_views.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     self.board = BoardFactory()
     self.threads = ThreadFactory.create_batch(5, board=self.board)
     self.list_resp = self.client.get(reverse('api_thread-list'))
     self.thread = ThreadFactory()
     self.url = reverse('api_thread-detail', kwargs={'thread_number': self.thread.thread_number})
     self.detail_resp = self.client.get(self.url)
コード例 #5
0
 def setUp(self):
     self.board = BoardFactory()
     self.threads = ThreadFactory.create_batch(5, board=self.board)
     self.thread1 = ThreadFactory(subject='test', board=self.board)
     self.thread2 = ThreadFactory(post='test', board=self.board)
     self.archived_thread = ThreadFactory(board=self.board, archived=True)
     self.resp_all_threads = self.client.get(self.board.get_catalog_url())
     self.resp_specific = self.client.get('{}?search={}'.format(
         self.board.get_catalog_url(), 'test'))
     self.resp_post_search = self.client.post(self.board.get_catalog_url(),
                                              {'search_term': 'Test'})
コード例 #6
0
ファイル: test_views.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     yesterday = DateFactory.yesterday()
     self.board = BoardFactory()
     self.threads = ThreadFactory.create_batch(5,
                                               time_made=yesterday,
                                               board=self.board,
                                               archived=True)
     self.not_archived = ThreadFactory(time_made=yesterday,
                                       board=self.board,
                                       archived=False)
     self.resp = self.client.get(self.threads[0].get_archive_day_url())
コード例 #7
0
ファイル: test_views.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     last_month = DateFactory.last_month()
     self.board = BoardFactory()
     self.threads = ThreadFactory.create_batch(5,
                                               time_made=last_month,
                                               board=self.board,
                                               archived=True)
     self.not_archived = ThreadFactory(time_made=last_month,
                                       board=self.board,
                                       archived=False)
     self.resp = self.client.get(self.threads[0].get_archive_month_url())
コード例 #8
0
 def setUp(self):
     mod = ModeratorFactory.create_mod()
     self.client.force_login(mod)
     self.board = BoardFactory()
     self.last_thread = ThreadFactory(reported=True, board=self.board)
     self.threads = ThreadFactory.create_batch(150,
                                               reported=True,
                                               board=self.board)
     self.resp = self.client.get('{}?board={}'.format(
         reverse('dj-mod:moderation_thread_report_list'), self.board.slug))
     self.resp2 = self.client.get('{}?board={}&page=2'.format(
         reverse('dj-mod:moderation_thread_report_list'), self.board.slug))
コード例 #9
0
ファイル: test_views.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     last_year = DateFactory.last_year()
     self.board = BoardFactory()
     self.thread = ThreadFactory(time_made=last_year,
                                 board=self.board,
                                 archived=True)
     self.threads = ThreadFactory.create_batch(50,
                                               time_made=last_year,
                                               board=self.board,
                                               archived=True)
     self.first_page = self.client.get(self.thread.get_archive_year_url())
     self.second_page = self.client.get('{}?page=2'.format(
         self.thread.get_archive_year_url()))
コード例 #10
0
 def setUp(self):
     self.board = BoardFactory()
     self.thread = ThreadFactory(board=self.board)
     self.thread2 = ThreadFactory(board=self.board)
     threads = ThreadFactory.create_batch(110, board=self.board)
     self.thread.refresh_from_db()
コード例 #11
0
ファイル: test_models.py プロジェクト: Tsuribori/imagenaut
 def setUp(self):
     self.board = BoardFactory()
     self.old_thread = ThreadFactory(board=self.board)
     threads = ThreadFactory.create_batch(
         100, board=self.board)  #Make enough new threads to archive the old
     self.old_thread.refresh_from_db()  #Get the refreshed data