def _determine_seat_type(self, product): """ Return the seat type based on the product class """ seat_type = None if product.get_product_class().name == SEAT_PRODUCT_CLASS_NAME: seat_type = get_certificate_type_display_value(product.attr.certificate_type) elif product.get_product_class().name == ENROLLMENT_CODE_PRODUCT_CLASS_NAME: seat_type = get_certificate_type_display_value(product.attr.seat_type) return seat_type
def _determine_seat_type(self, product): """ Return the seat type based on the product class """ seat_type = None if product.is_seat_product: seat_type = get_certificate_type_display_value(product.attr.certificate_type) elif product.is_enrollment_code_product: seat_type = get_certificate_type_display_value(product.attr.seat_type) return seat_type
def _determine_seat_type(self, product): """ Return the seat type based on the product class """ seat_type = None if product.get_product_class().name == SEAT_PRODUCT_CLASS_NAME: seat_type = get_certificate_type_display_value(product.attr.certificate_type) elif product.get_product_class().name == ENROLLMENT_CODE_PRODUCT_CLASS_NAME: seat_type = get_certificate_type_display_value(product.attr.seat_type) return seat_type
def test_cert_display_assertion(self): """ Verify assertion for invalid cert type """ self.assertRaises(ValueError, lambda: get_certificate_type_display_value('junk'))
def test_cert_display(self, cert_type, cert_display): """ Verify certificate display types. """ self.assertEqual(get_certificate_type_display_value(cert_type), cert_display)
def _get_certificate_type_display_value(self, product): certificate_type = self._get_certificate_type(product) if certificate_type: return get_certificate_type_display_value(certificate_type) return None
def test_cert_display_assertion(self): """ Verify assertion for invalid cert type """ self.assertRaises(ValueError, lambda: get_certificate_type_display_value('junk'))
def test_cert_display(self, cert_type, cert_display): """ Verify certificate display types. """ self.assertEqual(get_certificate_type_display_value(cert_type), cert_display)