コード例 #1
0
ファイル: factories.py プロジェクト: yjoshuaz/openFEC
class BaseReportsFactory(BaseFactory):
    committee_id = factory.LazyAttribute(
        lambda o: CommitteeFactory().committee_id)
コード例 #2
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class RiskAssessmentFactory(TitledFactory):
    class Meta:
        model = all_models.RiskAssessment

    status = "Draft"
    program = factory.LazyAttribute(lambda _: ProgramFactory())
コード例 #3
0
ファイル: factories.py プロジェクト: aresti/bryn
class UserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = User

    username = factory.Sequence(lambda n: "user%d" % n)
    email = factory.LazyAttribute(lambda obj: "*****@*****.**" % obj.username)
コード例 #4
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class StandardFactory(TitledFactory):
    """Standard factory class"""
    class Meta:
        model = all_models.Standard

    description = factory.LazyAttribute(lambda _: random_str(length=100))
コード例 #5
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class ReviewFactory(ModelFactory):
    class Meta:
        model = all_models.Review

    reviewable = factory.LazyAttribute(lambda _: ControlFactory())
    notification_type = all_models.Review.NotificationTypes.EMAIL_TYPE
コード例 #6
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class IssueTrackerIssueFactory(TitledFactory):
    class Meta:
        model = all_models.IssuetrackerIssue

    issue_tracked_obj = factory.LazyAttribute(lambda m: AssessmentFactory())
    issue_id = factory.LazyAttribute(lambda _: random.randint(1, 1000))
コード例 #7
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class ProgramFactory(TitledFactory):
    class Meta:
        model = all_models.Program

    context = factory.LazyAttribute(lambda _: ContextFactory())
コード例 #8
0
class InventoryFactory(factory.django.DjangoModelFactory):
    made_at = factory.LazyAttribute(lambda o: datetime.datetime.utcnow())

    class Meta:
        model = Inventory
コード例 #9
0
ファイル: factories.py プロジェクト: pythonitalia/pycon
class StripeCustomerFactory(ModelFactory):
    class Meta:
        model = StripeCustomer

    stripe_customer_id = factory.LazyAttribute(lambda _: f"cus_{fake.uuid4()}")
コード例 #10
0
ファイル: factories.py プロジェクト: yohanboniface/udata
class GeoLevelFactory(MongoEngineFactory):
    class Meta:
        model = GeoLevel

    id = factory.LazyAttribute(lambda o: unique_string())
    name = factory.Faker('name')
コード例 #11
0
class FileFactory(factory.django.DjangoModelFactory):
    file = factory.LazyAttribute(lambda x: choice(File.PATHS)[0])

    class Meta:
        model = File
        django_get_or_create = ('file', )
コード例 #12
0
ファイル: factories.py プロジェクト: yohanboniface/udata
class SpatialCoverageFactory(MongoEngineFactory):
    class Meta:
        model = SpatialCoverage

    geom = factory.Faker('multipolygon')
    granularity = factory.LazyAttribute(random_spatial_granularity)
コード例 #13
0
class ArticleFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Article
        django_get_or_create = ('title', 'path')

    path = factory.Sequence(
        lambda n: u'00010{}'.format(n))  # Article sequence starts from 0001020
    depth = 2
    numchild = 0
    title = "Article Page"
    slug = factory.LazyAttribute(lambda obj: slugify(obj.title))
    live = True
    has_unpublished_changes = False
    seo_title = " "
    show_in_menus = False
    search_description = " "
    go_live_at = '2011-10-24 12:43'
    expire_at = '2050-12-31 12:43'
    expired = False
    content_type = factory.SubFactory(ContentTypeFactory,
                                      app_label="article",
                                      model="article")
    locked = False
    latest_revision_created_at = '2011-10-24 12:43'
    first_published_at = '2011-10-24 12:43'

    strap = "Article strap"
    content = "<p> Article Content ok </p>"

    show_modular_content = False
    modular_content = '[{"type": "paragraph", "value": {"content": "<p>This is a test</p>", "align_content": "default"}}, {"type": "n_column_paragraph", "value": {"paragraph": [{"content": "<p>A test that make test</p>", "align_content": "default"}]}}, {"type": "n_column_paragraph", "id": "f9908f13-68ad-4eb5-9943-5e1cd92a944a", "value": {"paragraph": [{"content": "<p>A test that make test</p>", "align_content": "default"}]}}]'

    language = "en"

    @classmethod
    def _setup_next_sequence(cls):
        return getattr(cls, 'starting_seq_num', 20)

    @factory.post_generation
    def featured_image(self, create, extracted, **kwargs):
        if not create:
            return

        if extracted:
            self.featured_image = extracted

    @factory.post_generation
    def authors(self, create, extracted, **kwargs):
        if not create:
            return

        if extracted:
            for author in extracted:
                self.authors.add(author)

    @factory.post_generation
    def categories(self, create, extracted, **kwargs):
        if not create:
            return

        if extracted:
            for category in extracted:
                self.categories.add(category)

    @factory.post_generation
    def locations(self, create, extracted, **kwargs):
        if not create:
            return

        if extracted:
            for location in extracted:
                self.locations.add(location)
コード例 #14
0
ファイル: factories.py プロジェクト: l-etabli/wagtail-debut
class CustomImageFactory(factory.DjangoModelFactory):
    title = factory.sequence(lambda x: "extended-image-{0}".format([x]))
    file = factory.LazyAttribute(lambda x: get_test_image_file())

    class Meta:
        model = CustomImage
コード例 #15
0
class GeoLevelFactory(MongoEngineFactory):
    class Meta:
        model = models.GeoLevel

    id = factory.LazyAttribute(lambda o: unique_string())
    name = factory.LazyAttribute(lambda o: faker.name())
コード例 #16
0
class PollFactory(factory.DjangoModelFactory):
    class Meta:
        model = models.Poll

    question = factory.Faker("sentence")
    pub_date = factory.LazyAttribute(lambda __: timezone.now())
コード例 #17
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class ControlFactory(TitledFactory):
    class Meta:
        model = all_models.Control

    directive = factory.LazyAttribute(lambda m: RegulationFactory())
    recipients = ""
コード例 #18
0
ファイル: conftest.py プロジェクト: jetbridge/flask-crud
class HumanFactory(factory.Factory):
    class Meta:
        model = Human

    name = factory.LazyAttribute(lambda x: faker.name())
コード例 #19
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class AssessmentFactory(TitledFactory):
    class Meta:
        model = all_models.Assessment

    audit = factory.LazyAttribute(lambda m: AuditFactory())
コード例 #20
0
class DatasetDiscussionFactory(MongoEngineFactory):
    class Meta:
        model = models.DatasetDiscussion

    title = factory.LazyAttribute(lambda o: faker.sentence())
コード例 #21
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class PersonFactory(ModelFactory):
    class Meta:
        model = all_models.Person

    email = factory.LazyAttribute(
        lambda _: random_str(chars=string.ascii_letters) + "@example.com")
コード例 #22
0
class OrganizationFactory(MongoEngineFactory):
    class Meta:
        model = models.Organization

    name = factory.LazyAttribute(lambda o: faker.sentence())
    description = factory.LazyAttribute(lambda o: faker.text())
コード例 #23
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class ProposalFactory(ModelFactory):
    class Meta:
        model = all_models.Proposal

    proposed_by = factory.LazyAttribute(lambda _: PersonFactory())
    content = None
コード例 #24
0
class LicenseFactory(MongoEngineFactory):
    class Meta:
        model = models.License

    id = factory.LazyAttribute(lambda o: faker.word())
    title = factory.LazyAttribute(lambda o: faker.sentence())
コード例 #25
0
ファイル: factories.py プロジェクト: orf53975/ggrc-core
class TitledFactory(ModelFactory):
    title = factory.LazyAttribute(lambda m: random_str(prefix='title '))
コード例 #26
0
class SpatialCoverageFactory(MongoEngineFactory):
    class Meta:
        model = models.SpatialCoverage

    geom = factory.LazyAttribute(lambda o: faker.multipolygon())
    granularity = factory.LazyAttribute(random_spatial_granularity)
コード例 #27
0
ファイル: person.py プロジェクト: austinsdoe/osis
class PersonWithoutUserFactory(PersonFactory):
    user = None
    first_name = factory.Faker('first_name')
    last_name = factory.Faker('last_name')
    email = factory.LazyAttribute(generate_person_email)
コード例 #28
0
class TransferFactory(MongoEngineFactory):
    class Meta:
        model = models.Transfer

    comment = factory.LazyAttribute(lambda o: faker.sentence())
コード例 #29
0
class UserFavouriteEventFactory(BaseFactory):
    class Meta:
        model = UserFavouriteEvent

    user = factory.LazyAttribute(lambda a: User.query.first())
    event = factory.SubFactory(EventFactoryBasic)
コード例 #30
0
ファイル: factories.py プロジェクト: yjoshuaz/openFEC
class BaseTotalsFactory(BaseFactory):
    committee_id = factory.LazyAttribute(
        lambda o: CommitteeFactory().committee_id)
    cycle = 2016