def test_project_form(self): Login.setUp(self) form = ProjectForm({ 'name': 'example project', 'description': 'example description', 'status': 'Work' }) self.assertTrue(form.is_valid())
def test_task_model(self): current_time = timezone.now() # Creating a project project = Project(name="Project", description="Example Description", status="Work", user=Login.setUp(self), user_id=1, published_date=current_time) project.save() # Creating a task task = Task(name="Task", description="Example Description", project=project, status="To Do", priority="High", screenshot="", published_date=current_time) task.save() self.assertEqual(task.name, "Task") self.assertEqual(task.description, "Example Description") self.assertEqual(task.status, "To Do") self.assertEqual(task.priority, "High") self.assertEqual(task.published_date, current_time)
def test_view_only_project_view(self): current_time = timezone.now() project = Project( name = "Project", description = "Example Description", status = "Work", user = Login.setUp(self), user_id = 1, published_date = current_time ) project.save() page = self.c.get("/projects/{}/view/".format(project.id)) self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, "project_tasks.html")
def test_project_model(self): current_time = timezone.now() project = Project( name = "Project", description = "Example Description", status = "Work", user = Login.setUp(self), user_id = 1, published_date = current_time ) project.save() self.assertEqual(project.name, "Project") self.assertEqual(project.description, "Example Description") self.assertEqual(project.status, "Work") self.assertEqual(project.user_id, 1) self.assertEqual(project.published_date, current_time)
def test_home_logged_in_view(self): Login.setUp(self) page = self.c.get("/dashboard/") self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, "dashboard.html")
def test_all_products(self): Login.setUp(self) page = self.c.get("/products/") self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, "products.html")