This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from board.models import Question # Model class | |
test_question1 = Question(title='Question1',) | |
test_question1.id = 1 | |
test_question1.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from board.models import Question # Model class | |
test_question1 = Question(title='Question1',) | |
test_question1.id = 1 | |
test_question1.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import reverse | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
def test_title_redirects_to_details(self): | |
self.browser.get(self.live_server_url + reverse('question-list')) | |
title = WebDriverWait(self.browser, 5).until( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_create_button(self): | |
self.browser.get(self.live_server_url + 'question/create/') | |
# Test the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_Open_is_initial_active_tab(self): | |
self.browser.get(self.live_server_url + reverse('question-list')) | |
# Test the page 'question-list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_Open_is_initial_active_tab(self): | |
self.browser.get(self.live_server_url + reverse('question-list') | |
# Test the url 'question-list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.staticfiles.testing import StaticLiveServerTestCase | |
from selenium import webdriver | |
class TestName(StaticLiveServerTestCase): | |
@classmethod | |
def setUpClass(cls): | |
super().setUpClass() | |
cls.browser = webdriver.Firefox() | |
@classmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from django.contrib.auth.models import User | |
from django.contrib import auth | |
class FrontPageViewTest(TestCase): | |
@classmethod | |
def setUpTestData(cls): | |
""" Creates 1 user """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.forms import AuthenticationForm | |
from django.shortcuts import render | |
from research.forms import UserCreateForm # Custom register form | |
def front_page_view(request): | |
if request.method == 'POST': | |
if 'login_form' in request.POST: | |
login_form = AuthenticationForm(request=request, data=request.POST) |
NewerOlder