示例#1
0
def fixture_default_data(experiment_name, experiment_type):
    branches = []
    preferences = [None, None]

    for count, item in enumerate(preferences):
        branches.append(
            BaseBranchDataClass(
                branch_name=f"e2e-addon-branch-{count}",
                branch_description="e2e Branch Description",
                preferences=item,
            )
        )

    return BaseDataClass(
        type_name=experiment_name,
        action_name=experiment_type,
        addon_url="https://url.com/addon-url.xpi",
        experiment_type="channel",
        channels="Nightly",
        min_version=99,
        max_version=100,
        user_facing_name="e2e testing addon name",
        user_facing_description="e2e testing addon description",
        branches=sorted(branches, key=lambda x: x.branch_name),
    )
示例#2
0
def fixture_default_data(experiment_name, experiment_type):
    """Default data needed to create an experiment."""
    branches = []
    preferences = [
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing",
            preference_branch_type="default",
            preference_type="boolean",
            preference_value="true",
        ),
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing",
            preference_branch_type="default",
            preference_type="boolean",
            preference_value="false",
        ),
    ]
    for count, item in enumerate(preferences):
        branches.append(
            BaseBranchDataClass(
                branch_name=f"e2e-default-branch-{count}", preferences=item
            )
        )

    return BaseDataClass(
        type_name=experiment_name,
        action_name=experiment_type,
        experiment_type="channel",
        channels="Nightly",
        min_version=99,
        max_version=100,
        user_facing_name="e2e testing name",
        user_facing_description="e2e testing description",
        branches=sorted(branches, key=lambda x: x.branch_name),
    )
def fixture_default_data(experiment_name, experiment_type):
    branches = []
    preferences = [
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing",
            preference_branch_type="default",
            preference_type="boolean",
            preference_value="true",
        ),
    ]

    branches.append(
        BaseBranchDataClass(
            addon_url="http://addon.com/addon.xpi",
            branch_name="e2e-rollout-branch-0",
            preferences=preferences,
        ))

    return BaseDataClass(
        type_name=experiment_name,
        action_name=experiment_type,
        experiment_type="channel",
        channels="Nightly",
        min_version=99,
        max_version=100,
        user_facing_name="e2e testing rollout pref experiment",
        user_facing_description="e2e testing rollout pref description",
        branches=sorted(branches, key=lambda x: x.branch_name),
    )
def fixture_default_data():
    branches = []
    preferences = [
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing-branch-1",
            preference_branch_type="default",
            preference_type="boolean",
            preference_value="true",
        ),
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing-branch-1-1",
            preference_branch_type="default",
            preference_type="integer",
            preference_value="10",
        ),
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing-branch-2",
            preference_branch_type="default",
            preference_type="string",
            preference_value="pref-string",
        ),
        BasePreferencesDataClass(
            preference_branch_name="e2e-testing-branch-2-1",
            preference_branch_type="default",
            preference_type="json string",
            preference_value='{"object": "name"}',
        ),
    ]

    branches = [
        BaseBranchDataClass(
            branch_name="e2e-singlepref-branch",
            branch_description="multipref-branch-description",
            preferences=sorted(preferences[:-2],
                               key=lambda x: x.preference_branch_name),
        ),
        BaseBranchDataClass(
            branch_name="e2e-singlepref-branch-2",
            branch_description="multipref-branch-description",
            preferences=sorted(preferences[-2:],
                               key=lambda x: x.preference_branch_name),
        ),
    ]

    return BaseDataClass(
        type_name="Pref-Flip Experiment",
        action_name="multi-preference-experiment",
        experiment_type="channel",
        channels="Nightly",
        min_version=99,
        max_version=100,
        user_facing_name="e2e testing name",
        user_facing_description="e2e testing description",
        branches=sorted(branches, key=lambda x: x.branch_name),
    )