Fixing elements to cover tests. · pythonDrive/bootcamp@fe104a6 · GitHub
Skip to content

Commit fe104a6

Browse files
Fixing elements to cover tests.
1 parent c532276 commit fe104a6

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

bootcamp/qa/tests/test_models.py

Lines changed: 1 addition & 1 deletion

bootcamp/qa/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class QuestionDetailView(LoginRequiredMixin, DetailView):
5353
"""View to call a given Question object and to render all the details about
5454
that Question."""
5555
model = Question
56-
context_object_name = 'question'
56+
context_object_name = "question"
5757

5858

5959
class CreateQuestionView(LoginRequiredMixin, CreateView):
@@ -62,15 +62,15 @@ class CreateQuestionView(LoginRequiredMixin, CreateView):
6262
"""
6363
form_class = QuestionForm
6464
template_name = "qa/question_form.html"
65-
message = _('Your question has been created.')
65+
message = _("Your question has been created.")
6666

6767
def form_valid(self, form):
6868
form.instance.user = self.request.user
6969
return super().form_valid(form)
7070

7171
def get_success_url(self):
7272
messages.success(self.request, self.message)
73-
return reverse("qa:index")
73+
return reverse("qa:index_noans")
7474

7575

7676
class CreateAnswerView(LoginRequiredMixin, CreateView):
@@ -83,7 +83,7 @@ class CreateAnswerView(LoginRequiredMixin, CreateView):
8383

8484
def form_valid(self, form):
8585
form.instance.user = self.request.user
86-
form.instance.question_id = self.kwargs['question_id']
86+
form.instance.question_id = self.kwargs["question_id"]
8787
return super().form_valid(form)
8888

8989
def get_success_url(self):

bootcamp/search/tests/test_views.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from django.contrib.auth import get_user_model
21
from django.urls import reverse
32
from django.test import Client
43

@@ -21,8 +20,7 @@ def setUp(self):
2120
self.client = Client()
2221
self.other_client = Client()
2322
self.client.login(username="first_user", password="password")
24-
self.other_client.login(
25-
username="second_user", password="password")
23+
self.other_client.login(username="second_user", password="password")
2624
self.title = "A really nice to-be first title "
2725
self.content = """This is a really good content, just if somebody
2826
published it, that would be awesome, but no, nobody wants to publish

bootcamp/templates/qa/question_form.html

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)