コード例 #1
0
def test_organization_copy_to_jobs():
    '''
    All unified job types should infer their organization from their template organization
    '''
    for cls in UnifiedJobTemplate.__subclasses__():
        if cls is WorkflowApprovalTemplate:
            continue  # these do not track organization
        assert 'organization' in cls._get_unified_job_field_names(), cls
コード例 #2
0
def test_unified_template_field_consistency():
    """
    Example of what is being tested:
    The endpoints /projects/N/ and /projects/ should have the same fields as
    that same project when it is serialized by the unified job template serializer
    in /unified_job_templates/
    """
    for cls in UnifiedJobTemplate.__subclasses__():
        detail_serializer = getattr(serializers,
                                    '{}Serializer'.format(cls.__name__))
        unified_serializer = serializers.UnifiedJobTemplateSerializer(
        ).get_sub_serializer(cls())
        assert set(detail_serializer().fields.keys()) == set(
            unified_serializer().fields.keys())