Esempio n. 1
0
 def test_cannot_save_no_service_instance(self):
     SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
     SERVICE_DATA['operator'] = self.operator.pk
     SERVICE_DATA['customer'] = self.customer.pk
     SERVICE_DATA['category'] = self.category.pk
     form = ServiceCreationForm(SERVICE_DATA)
     self.assertFalse(form.is_valid())
Esempio n. 2
0
 def test_cannot_save_not_found_category(self):
     SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
     SERVICE_DATA['customer'] = self.customer.pk
     SERVICE_DATA['operator'] = self.operator.pk
     SERVICE_DATA['service_instance'] = self.availabe_service.pk
     SERVICE_DATA['category'] = category_test_data.CATEGORY_NOT_FOUND_PK
     form = ServiceCreationForm(SERVICE_DATA)
     self.assertFalse(form.is_valid())
Esempio n. 3
0
 def test_cannot_save_bad_3_commission(self):
     SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
     SERVICE_DATA['operator'] = self.operator.pk
     SERVICE_DATA['customer'] = self.customer.pk
     SERVICE_DATA['category'] = self.category.pk
     SERVICE_DATA['service_instance'] = self.availabe_service.pk
     SERVICE_DATA['commission'] = service_test_data.SERVICE_COMMISSION_BAD_3
     logger.info("Service Test BAD_3 COMMISSION : %s", SERVICE_DATA)
     form = ServiceCreationForm(SERVICE_DATA)
     self.assertFalse(form.is_valid())
Esempio n. 4
0
 def test_cannot_save_bad_issued_at(self):
     SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
     SERVICE_DATA['operator'] = self.operator.pk
     SERVICE_DATA['customer'] = self.customer.pk
     SERVICE_DATA['category'] = self.category.pk
     SERVICE_DATA['service_instance'] = self.availabe_service.pk
     SERVICE_DATA['issued_at'] = service_test_data.SERVICE_ISSUED_AT_BAD
     logger.info("Service Test BAD DATE : %s", SERVICE_DATA)
     form = ServiceCreationForm(SERVICE_DATA)
     self.assertFalse(form.is_valid())
Esempio n. 5
0
 def test_cannot_save_operator_is_not_available_service_operator(self):
     SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
     SERVICE_DATA['operator'] = self.dummy_user.pk
     SERVICE_DATA['customer'] = self.customer.pk
     SERVICE_DATA['category'] = self.category.pk
     SERVICE_DATA['service_instance'] = self.availabe_service.pk
     logger.info("Service Test OPERATOR_NOT_AVS_OPERATOR : %s",
                 SERVICE_DATA)
     form = ServiceCreationForm(SERVICE_DATA)
     is_valid = form.is_valid()
     """
     if not is_valid:
         logger.error("ServiceCreationForm is not valid.")            
         for field in form:
             logger.error("\t\tServiceCreationForm Field %s", field)
             if field.errors:
                 for e in field.errors:
                     logger.error("\t\t\tServiceCreationForm Error  : %s: ", e)
     """
     self.assertFalse(is_valid)
Esempio n. 6
0
    def test_can_save(self):
        SERVICE_DATA = service_test_data.SERVICE_DATA_INITIAL.copy()
        SERVICE_DATA['operator'] = self.operator.pk
        SERVICE_DATA['customer'] = self.customer.pk
        SERVICE_DATA['category'] = self.category.pk
        SERVICE_DATA['service_instance'] = self.availabe_service.pk
        SERVICE_DATA['commission'] = service_test_data.SERVICE_COMMISSION
        logger.info("Service Test CAN SAVE : %s", SERVICE_DATA)

        form = ServiceCreationForm(SERVICE_DATA)

        is_valid = form.is_valid()
        """
        if not is_valid:
            logger.error("ServiceCreationForm is not valid.")            
            for field in form:
                logger.error("\t\tServiceCreationForm Field %s", field)
                if field.errors:
                    for e in field.errors:
                        logger.error("\t\t\tServiceCreationForm Error  : %s: ", e)

        """
        self.assertTrue(is_valid)
Esempio n. 7
0
 def test_cannot_save_initial_data(self):
     form = ServiceCreationForm(service_test_data.SERVICE_DATA_INITIAL)
     self.assertFalse(form.is_valid())