def test_new_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(test_case=self,
                                    url_name='orders:order-new',
                                    exp_status_code=200,
                                    exp_template='order_form.html')
     self.assertTrue(isinstance(response.context['form'], OrderForm))
Ejemplo n.º 2
0
 def test_list(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(test_case=self,
                                    url_name='products:products-list',
                                    exp_status_code=200,
                                    exp_template='products_list.html')
     self.assertEqual(
         response.context['page_obj'].paginator.num_pages,
         ceil(len(self.products) / PAGINATION_OBJ_COUNT_PER_PAGE))
 def test_update_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(test_case=self,
                                    url_name='orders:order-update',
                                    exp_status_code=200,
                                    exp_template='order_form.html',
                                    id=self.order_to_be_updated.id)
     self.assertEqual(response.context['form'].instance.id,
                      self.order_to_be_updated.id)
Ejemplo n.º 4
0
 def test_delete_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(
         test_case=self,
         url_name='products:product-delete',
         exp_status_code=200,
         exp_template='product_confirm_delete.html',
         id=self.product_to_be_deleted.id)
     self.assertEqual(response.context['product'].id,
                      self.product_to_be_deleted.id)
Ejemplo n.º 5
0
 def test_new_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(test_case=self,
                                    url_name='products:product-new',
                                    exp_status_code=200,
                                    exp_template='product_form.html')
     self.assertTrue(
         isinstance(response.context['form']['product'], ProductForm))
     self.assertTrue(
         isinstance(response.context['form']['spec'], SpecificationForm))
Ejemplo n.º 6
0
 def test_form_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(
         test_case=self,
         url_name='products:specification-issue',
         exp_status_code=200,
         exp_template='specification_issue_form.html',
         id=self.product.id)
     self.assertTrue(
         isinstance(response.context['form'], SpecificationIssueForm))
Ejemplo n.º 7
0
 def test_pdf_render_view(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(
         test_case=self,
         url_name='products:specification-pdf-render',
         exp_status_code=200,
         exp_template='specification_to_pdf.html',
         id=self.specification_issued.id)
     self.assertTrue(
         isinstance(response.context['specification_issued'],
                    SpecificationIssued))
 def test_update_get(self):
     self.view_client.login(username=self.user.username, password=PASSWORD)
     response = assert_response_get(
         test_case=self,
         url_name='orders:measurement-report-update',
         id=self.order_update.id,
         exp_status_code=200,
         exp_template='measurement_report_form.html')
     self.assertEqual(response.context['order'], self.order_update)
     self.assertEqual(response.context['form'].instance,
                      self.order_update.measurement_report)
     self.assertEqual(len(response.context['formset']),
                      self.measurement_report_count)
    def test_new_get(self):
        self.view_client.login(username=self.user.username, password=PASSWORD)
        response = assert_response_get(
            test_case=self,
            url_name='orders:measurement-report-new',
            id=self.order_new.id,
            exp_status_code=200,
            exp_template='measurement_report_form.html')
        self.assertEqual(response.context['order'], self.order_new)

        self.assertTrue(
            isinstance(response.context['form'], MeasurementReportForm))
        self.assertTrue(
            isinstance(response.context['formset'], MeasurementFormSet))