factories.py 2.96 KB
Newer Older
1 2
# Factories are self documenting
# pylint: disable=missing-docstring
3
from uuid import uuid4
4

5
from factory.django import DjangoModelFactory
6

7
from certificates.models import (
8 9
    GeneratedCertificate, CertificateStatuses, CertificateHtmlViewConfiguration, CertificateWhitelist,
    CertificateInvalidation,
10
)
11
from student.models import LinkedInAddToProfileConfiguration
12

13

14 15
class GeneratedCertificateFactory(DjangoModelFactory):

muhammad-ammar committed
16 17
    class Meta(object):
        model = GeneratedCertificate
18 19 20

    course_id = None
    status = CertificateStatuses.unavailable
21
    mode = GeneratedCertificate.MODES.honor
22
    name = ''
23
    verify_uuid = uuid4().hex
24 25


26 27
class CertificateWhitelistFactory(DjangoModelFactory):

muhammad-ammar committed
28 29
    class Meta(object):
        model = CertificateWhitelist
30 31 32

    course_id = None
    whitelist = True
33
    notes = 'Test Notes'
34 35


36 37 38 39 40 41 42 43 44
class CertificateInvalidationFactory(DjangoModelFactory):

    class Meta(object):
        model = CertificateInvalidation

    notes = 'Test Notes'
    active = True


45 46
class CertificateHtmlViewConfigurationFactory(DjangoModelFactory):

muhammad-ammar committed
47 48
    class Meta(object):
        model = CertificateHtmlViewConfiguration
49 50 51 52

    enabled = True
    configuration = """{
            "default": {
53
                "accomplishment_class_append": "accomplishment-certificate",
54
                "platform_name": "edX",
55
                "company_about_url": "http://www.edx.org/about-us",
56 57 58
                "company_privacy_url": "http://www.edx.org/edx-privacy-policy",
                "company_tos_url": "http://www.edx.org/edx-terms-service",
                "company_verified_certificate_url": "http://www.edx.org/verified-certificate",
59
                "document_stylesheet_url_application": "/static/certificates/sass/main-ltr.css",
60
                "logo_src": "/static/certificates/images/logo-edx.png",
61 62 63 64
                "logo_url": "http://www.edx.org"
            },
            "honor": {
                "certificate_type": "Honor Code",
65 66
                "certificate_title": "Certificate of Achievement",
                "logo_url": "http://www.edx.org/honor_logo.png"
67 68 69
            },
            "verified": {
                "certificate_type": "Verified",
70
                "certificate_title": "Verified Certificate of Achievement"
71 72
            },
            "xseries": {
73 74
                "certificate_title": "XSeries Certificate of Achievement",
                "certificate_type": "XSeries"
75 76
            },
            "microsites": {
77 78 79 80
                "test-site": {
                    "company_about_url": "http://www.test-site.org/about-us",
                    "company_privacy_url": "http://www.test-site.org/edx-privacy-policy",
                    "company_tos_url": "http://www.test-site.org/edx-terms-service"
81
                }
82 83
            }
        }"""
84 85 86 87


class LinkedInAddToProfileConfigurationFactory(DjangoModelFactory):

muhammad-ammar committed
88 89
    class Meta(object):
        model = LinkedInAddToProfileConfiguration
90 91 92 93

    enabled = True
    company_identifier = "0_0dPSPyS070e0HsE9HNz_13_d11_"
    trk_partner_name = 'unittest'