def setup_view(self, **thread_kwargs): # lint-amnesty, pylint: disable=missing-function-docstring thread_kwargs.update({'commentable_id': self.discussion_id}) view = SingleThreadViewFixture( Thread(id=self.thread_id, **thread_kwargs) ) view.addResponse(Response(id="response1")) view.push()
def setup_view(self): view = SingleThreadViewFixture( Thread(id="comment_edit_test_thread", commentable_id=self.discussion_id)) view.addResponse(Response(id="response1"), [ Comment(id="comment_other_author", user_id="other"), Comment(id="comment_self_author", user_id=self.user_id) ]) view.push()
def setup_view(self): # lint-amnesty, pylint: disable=missing-function-docstring view = SingleThreadViewFixture(Thread(id="response_edit_test_thread", commentable_id=self.discussion_id)) view.addResponse( Response(id="response_other_author", user_id="other", thread_id="response_edit_test_thread"), ) view.addResponse( Response(id="response_self_author", user_id=self.user_id, thread_id="response_edit_test_thread"), ) view.push()
def setup_multiple_threads(self, thread_count, **thread_kwargs): """ Set up multiple threads on the page by passing 'thread_count'. """ self.thread_ids = [] # pylint: disable=attribute-defined-outside-init threads = [] # pylint: disable=attribute-defined-outside-init for i in range(thread_count): thread_id = "test_thread_{}_{}".format(i, uuid4().hex) thread_body = "Dummy long text body." * 50 threads.append( Thread(id=thread_id, commentable_id=self.discussion_id, body=thread_body, **thread_kwargs), ) self.thread_ids.append(thread_id) thread_fixture = MultipleThreadFixture(threads) thread_fixture.push()
def setup_thread(self, num_responses, **thread_kwargs): """ Create a test thread with the given number of responses, passing all keyword arguments through to the Thread fixture, then invoke setup_thread_page. """ thread_id = "test_thread_{}".format(uuid4().hex) thread_fixture = SingleThreadViewFixture( Thread(id=thread_id, commentable_id=self.discussion_id, **thread_kwargs) ) for i in range(num_responses): thread_fixture.addResponse(Response(id=str(i), body=str(i))) thread_fixture.push() self.setup_thread_page(thread_id) return thread_id
def setup_multiple_threads(self, thread_count, **thread_kwargs): """ Set up multiple threads on the page by passing 'thread_count'. """ self.thread_ids = [] threads = [] for i in range(thread_count): thread_id = "test_thread_{}_{}".format(i, uuid4().hex) thread_body = "Dummy long text body." * 50 threads.append( Thread(id=thread_id, commentable_id=self.discussion_id, body=thread_body, **thread_kwargs), ) self.thread_ids.append(thread_id) thread_fixture = MultipleThreadFixture(threads) response = thread_fixture.push() self.assertTrue(response.ok, "Failed to push discussion content")
def setup_view(self, **thread_kwargs): thread_kwargs.update({'commentable_id': self.discussion_id}) view = SingleThreadViewFixture( Thread(id=self.thread_id, **thread_kwargs)) view.addResponse(Response(id="response1")) view.push()