How to use show_project method in tempest

Best Python code snippet using tempest_python

test_feature_13.py

Source:test_feature_13.py Github

copy

Full Screen

1from django.contrib.auth.models import User2from django.test import TestCase, Client3from django.urls import reverse4from django.utils import timezone5from .utils import Document6from projects.models import Project7from tasks.models import Task8class FeatureTests(TestCase):9 def setUp(self):10 self.client = Client()11 self.noor_credentials = {"username": "noor", "password": "1234abcd."}12 self.noor = User.objects.create_user(**self.noor_credentials)13 self.alisha = User.objects.create_user(14 username="alisha", password="1234abcd."15 )16 self.client.post(reverse("login"), self.noor_credentials)17 self.project = Project.objects.create(18 name="ZZZZZZ", description="AAAAA"19 )20 self.project.members.add(self.noor)21 def test_project_detail_returns_200(self):22 path = reverse("show_project", args=[self.project.id])23 response = self.client.get(path)24 self.assertEqual(25 response.status_code,26 200,27 msg="Did not get a 200 for project details",28 )29 def test_project_detail_shows_title(self):30 path = reverse("show_project", args=[self.project.id])31 response = self.client.get(path)32 document = Document()33 document.feed(response.content.decode("utf-8"))34 html = document.select("html")35 self.assertIn(36 "ZZZZZZ",37 html.inner_text(),38 msg="Did not find the project name on the page",39 )40 def test_project_detail_with_no_tasks_shows_message(self):41 path = reverse("show_project", args=[self.project.id])42 response = self.client.get(path)43 document = Document()44 document.feed(response.content.decode("utf-8"))45 html = document.select("html")46 self.assertIn(47 "This project has no tasks",48 html.inner_text(),49 msg="Did not find the 'no tasks' message on the page",50 )51 def test_project_detail_with_a_tasks_shows_task_name(self):52 task = Task.objects.create(53 name="YYYYYY",54 start_date=timezone.now(),55 due_date=timezone.now(),56 project=self.project,57 assignee=self.noor,58 )59 path = reverse("show_project", args=[self.project.id])60 response = self.client.get(path)61 document = Document()62 document.feed(response.content.decode("utf-8"))63 html = document.select("html")64 self.assertIn(65 task.name,66 html.inner_text(),67 msg="Did not find the task name in the detail page",68 )69 def test_project_detail_with_a_tasks_shows_task_start_date(self):70 task = Task.objects.create(71 name="YYYYYY",72 start_date=timezone.now(),73 due_date=timezone.now(),74 project=self.project,75 assignee=self.noor,76 )77 path = reverse("show_project", args=[self.project.id])78 response = self.client.get(path)79 document = Document()80 document.feed(response.content.decode("utf-8"))81 html = document.select("html")82 self.assertIn(83 str(task.start_date.year),84 html.inner_text(),85 msg="Did not find the task start date in the detail page",86 )87 def test_project_detail_with_a_tasks_shows_task_due_date(self):88 task = Task.objects.create(89 name="YYYYYY",90 start_date=timezone.now(),91 due_date=timezone.now(),92 project=self.project,93 assignee=self.noor,94 )95 path = reverse("show_project", args=[self.project.id])96 response = self.client.get(path)97 document = Document()98 document.feed(response.content.decode("utf-8"))99 html = document.select("html")100 self.assertIn(101 str(task.due_date.year),102 html.inner_text(),103 msg="Did not find the task start date in the detail page",104 )105 def test_project_detail_with_a_tasks_shows_assignee(self):106 Task.objects.create(107 name="YYYYYY",108 start_date=timezone.now(),109 due_date=timezone.now(),110 project=self.project,111 assignee=self.noor,112 )113 path = reverse("show_project", args=[self.project.id])114 response = self.client.get(path)115 document = Document()116 document.feed(response.content.decode("utf-8"))117 html = document.select("html")118 self.assertIn(119 self.noor.username,120 html.inner_text(),121 msg="Did not find the task start date in the detail page",122 )123 def test_project_detail_with_a_tasks_shows_is_completed(self):124 Task.objects.create(125 name="YYYYYY",126 start_date=timezone.now(),127 due_date=timezone.now(),128 project=self.project,129 assignee=self.noor,130 )131 path = reverse("show_project", args=[self.project.id])132 response = self.client.get(path)133 document = Document()134 document.feed(response.content.decode("utf-8"))135 html = document.select("html")136 self.assertIn(137 "no",138 html.inner_text(),139 msg="Did not find the task is completed in the detail page",140 )141 def test_project_detail_with_a_tasks_shows_name_header(self):142 Task.objects.create(143 name="YYYYYY",144 start_date=timezone.now(),145 due_date=timezone.now(),146 project=self.project,147 assignee=self.noor,148 )149 path = reverse("show_project", args=[self.project.id])150 response = self.client.get(path)151 document = Document()152 document.feed(response.content.decode("utf-8"))153 html = document.select("html")154 self.assertIn(155 "Name",156 html.inner_text(),157 msg="Did not find the header 'Name' in the detail page",158 )159 def test_project_detail_with_a_tasks_shows_assignee_header(self):160 Task.objects.create(161 name="YYYYYY",162 start_date=timezone.now(),163 due_date=timezone.now(),164 project=self.project,165 assignee=self.noor,166 )167 path = reverse("show_project", args=[self.project.id])168 response = self.client.get(path)169 document = Document()170 document.feed(response.content.decode("utf-8"))171 html = document.select("html")172 self.assertIn(173 "Assignee",174 html.inner_text(),175 msg="Did not find the header 'Assignee' in the detail page",176 )177 def test_project_detail_with_a_tasks_shows_start_date_header(self):178 Task.objects.create(179 name="YYYYYY",180 start_date=timezone.now(),181 due_date=timezone.now(),182 project=self.project,183 assignee=self.noor,184 )185 path = reverse("show_project", args=[self.project.id])186 response = self.client.get(path)187 document = Document()188 document.feed(response.content.decode("utf-8"))189 html = document.select("html")190 self.assertIn(191 "Start date",192 html.inner_text(),193 msg="Did not find the header 'Start date' in the detail page",194 )195 def test_project_detail_with_a_tasks_shows_due_date_header(self):196 Task.objects.create(197 name="YYYYYY",198 start_date=timezone.now(),199 due_date=timezone.now(),200 project=self.project,201 assignee=self.noor,202 )203 path = reverse("show_project", args=[self.project.id])204 response = self.client.get(path)205 document = Document()206 document.feed(response.content.decode("utf-8"))207 html = document.select("html")208 self.assertIn(209 "Due date",210 html.inner_text(),211 msg="Did not find the header 'Due date' in the detail page",212 )213 def test_project_detail_with_a_tasks_shows_is_completed_header(self):214 Task.objects.create(215 name="YYYYYY",216 start_date=timezone.now(),217 due_date=timezone.now(),218 project=self.project,219 assignee=self.noor,220 )221 path = reverse("show_project", args=[self.project.id])222 response = self.client.get(path)223 document = Document()224 document.feed(response.content.decode("utf-8"))225 html = document.select("html")226 self.assertIn(227 "Is completed",228 html.inner_text(),229 msg="Did not find the header 'Is completed' in the detail page",230 )231 def test_project_list_has_link_to_project(self):232 path = reverse("list_projects")233 project_path = reverse("show_project", args=[self.project.id])234 response = self.client.get(path)235 document = Document()236 document.feed(response.content.decode("utf-8"))237 html = document.select("html")238 children = html.get_all_children("a")239 detail_link = None240 for child in children:241 if child.attrs.get("href") == project_path:242 detail_link = child243 break244 self.assertIsNotNone(245 detail_link,246 msg="Did not find the detail link for the project in the page",247 )248 def test_project_list_has_number_of_tasks(self):249 Task.objects.create(250 name="YYYYYY",251 start_date=timezone.now(),252 due_date=timezone.now(),253 project=self.project,254 assignee=self.noor,255 )256 path = reverse("list_projects")257 response = self.client.get(path)258 document = Document()259 document.feed(response.content.decode("utf-8"))260 html = document.select("html")261 self.assertIn(262 "1",263 html.inner_text(),264 msg="Did not find the number of tasks for the project in the page",...

Full Screen

Full Screen

project_in_statusbar.py

Source:project_in_statusbar.py Github

copy

Full Screen

...13 # Show project in all views of all windows14 for window in sublime.windows ():15 for view in window.views ():16 show_project (view)17def show_project(view):18 """19 If a project file is in use, add the name of it to the start of the status20 bar.21 """22 if view.window() is None:23 return24 project_file = view.window ().project_file_name ()25 if project_file is not None:26 project_name = os.path.splitext (os.path.basename (project_file))[0]27 view.set_status ("00ProjectName", "[" + project_name + "]")28class ProjectInStatusbar(sublime_plugin.EventListener):29 """30 Display the name of the current project in the status bar.31 """...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful