示例#1
0
def addon(transactional_db, create_superuser, pytestconfig):
    """Creates a custom addon named 'Ui-Addon'.

    This addon will be a featured addon and will have a featured collecton
    attatched to it. It will belong to the user created by the
    'create_superuser' fixture.

    It has 1 preview, 5 reviews, and 2 authors. The second author is named
    'ui-tester2'. It has a version number as well as a beta version.
    """
    if not pytestconfig.option.usingliveserver:
        return

    default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
    addon = addon_factory(
        status=STATUS_PUBLIC,
        type=ADDON_EXTENSION,
        average_daily_users=5567,
        users=[UserProfile.objects.get(username='******')],
        average_rating=5,
        description=u'My Addon description',
        file_kw={
            'hash': 'fakehash',
            'platform': amo.PLATFORM_ALL.id,
            'size': 42,
        },
        guid=generate_addon_guid(),
        homepage=u'https://www.example.org/',
        icon_type=random.choice(default_icons),
        name=u'Ui-Addon',
        public_stats=True,
        slug='ui-test',
        summary=u'My Addon summary',
        support_email=u'*****@*****.**',
        support_url=u'https://support.example.org/support/ui-test-addon/',
        tags=['some_tag', 'another_tag', 'ui-testing',
              'selenium', 'python'],
        total_reviews=888,
        weekly_downloads=2147483647,
        developer_comments='This is a testing addon, used within pytest.',
        is_experimental=True,
    )
    Preview.objects.create(addon=addon, position=1)
    Review.objects.create(addon=addon, rating=5, user=user_factory())
    Review.objects.create(addon=addon, rating=3, user=user_factory())
    Review.objects.create(addon=addon, rating=2, user=user_factory())
    Review.objects.create(addon=addon, rating=1, user=user_factory())
    addon.reload()
    AddonUser.objects.create(user=user_factory(username='******'),
                             addon=addon, listed=True)
    version_factory(addon=addon, file_kw={'status': amo.STATUS_BETA},
                    version='1.1beta')
    addon.save()
    generate_collection(addon, app=FIREFOX)
    print('Created addon {0} for testing successfully'.format(addon.name))
    return addon
    def create_a_named_collection_and_addon(self, name, author):
        """Creates a collection with a name and author."""

        generate_collection(
            self.create_named_addon_with_author(name, author=author),
            app=FIREFOX,
            author=UserProfile.objects.get(username=author),
            type=amo.COLLECTION_FEATURED,
            name=name
        )
    def create_featured_collections(self):
        """Creates exactly 4 collections that are featured.

        This fixture uses the generate_collection function from olympia.

        """
        for _ in range(4):
            addon = addon_factory(type=amo.ADDON_EXTENSION)
            generate_collection(
                addon, APPS['firefox'], type=amo.COLLECTION_FEATURED)
示例#4
0
    def create_featured_addon_with_version(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number as well as a beta version.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        addon = addon_factory(
            status=STATUS_PUBLIC,
            type=ADDON_EXTENSION,
            average_daily_users=5000,
            users=[UserProfile.objects.get(username='******')],
            average_rating=5,
            description=u'My Addon description',
            file_kw={
                'hash': 'fakehash',
                'platform': amo.PLATFORM_ALL.id,
                'size': 42,
            },
            guid=generate_addon_guid(),
            icon_type=random.choice(default_icons),
            name=u'Ui-Addon',
            public_stats=True,
            slug='ui-test-2',
            summary=u'My Addon summary',
            tags=['some_tag', 'another_tag', 'ui-testing',
                  'selenium', 'python'],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon.',
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon, listed=True)
        if waffle.switch_is_active('beta-versions'):
            version_factory(addon=addon, file_kw={'status': amo.STATUS_BETA},
                            version='1.1beta')
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print(
            'Created addon {0} for testing successfully'
            .format(addon.name))
    def create_featured_collections(self):
        """Creates exactly 4 collections that are featured.

        This fixture uses the generate_collection function from olympia.

        """
        for _ in range(4):
            addon = addon_factory(type=amo.ADDON_EXTENSION)
            generate_collection(addon,
                                APPS['firefox'],
                                type=amo.COLLECTION_FEATURED)
示例#6
0
def collections(transactional_db, pytestconfig):
    """Creates exactly 4 collections that are featured.

    This fixture uses the generate_collection function from olympia.
    """
    if not pytestconfig.option.usingliveserver:
        return

    for _ in range(4):
        addon = addon_factory(type=amo.ADDON_EXTENSION)
        generate_collection(
            addon, APPS['firefox'], type=amo.COLLECTION_FEATURED)
示例#7
0
def collections(transactional_db, pytestconfig):
    """Creates exactly 4 collections that are featured.

    This fixture uses the generate_collection function from olympia.
    """
    if not pytestconfig.option.usingliveserver:
        return

    for _ in range(4):
        addon = addon_factory(type=amo.ADDON_EXTENSION)
        generate_collection(
            addon, APPS['firefox'], type=amo.COLLECTION_FEATURED)
示例#8
0
    def create_featured_themes(self):
        """Creates exactly 6 themes that will be not featured.

        These belong to the user uitest.

        It will also create 6 themes that are featured with random authors.

        """
        generate_themes(6, '*****@*****.**')
        for _ in range(6):
            addon = addon_factory(status=STATUS_PUBLIC, type=ADDON_PERSONA)
            generate_collection(addon, app=FIREFOX)
示例#9
0
    def create_featured_addon_with_version(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number as well as a beta version.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        addon = addon_factory(
            status=STATUS_PUBLIC,
            type=ADDON_EXTENSION,
            average_daily_users=5000,
            users=[UserProfile.objects.get(username='******')],
            average_rating=5,
            description=u'My Addon description',
            file_kw={
                'hash': 'fakehash',
                'platform': amo.PLATFORM_ALL.id,
                'size': 42,
            },
            guid=generate_addon_guid(),
            icon_type=random.choice(default_icons),
            name=u'Ui-Addon',
            public_stats=True,
            slug='ui-test-2',
            summary=u'My Addon summary',
            tags=['some_tag', 'another_tag', 'ui-testing',
                  'selenium', 'python'],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon.',
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon, listed=True)
        version_factory(addon=addon, file_kw={'status': amo.STATUS_BETA},
                        version='1.1beta')
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print(
            'Created addon {0} for testing successfully'
            .format(addon.name))
示例#10
0
    def create_featured_addon_with_version(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        addon = addon_factory(status=amo.STATUS_APPROVED,
                              type=ADDON_EXTENSION,
                              average_daily_users=5000,
                              users=[self.user],
                              average_rating=5,
                              description=u'My Addon description',
                              file_kw={'is_webextension': True},
                              guid=generate_addon_guid(),
                              icon_type=random.choice(default_icons),
                              name=u'Ui-Addon',
                              public_stats=True,
                              slug='ui-test-2',
                              summary=u'My Addon summary',
                              tags=[
                                  'some_tag', 'another_tag', 'ui-testing',
                                  'selenium', 'python'
                              ],
                              total_ratings=500,
                              weekly_downloads=9999999,
                              developer_comments='This is a testing addon.',
                              version_kw={
                                  'recommendation_approved': True,
                                  'nomination': days_ago(6)
                              })
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon,
                                 listed=True)
        addon.save()
        DiscoveryItem.objects.create(recommendable=True, addon=addon)
        generate_collection(addon, app=FIREFOX)
        print('Created addon {0} for testing successfully'.format(addon.name))
示例#11
0
def themes(transactional_db, create_superuser, pytestconfig):
    """Creates exactly 6 themes that will be not featured.

    These belong to the user created by the 'create_superuser' fixture.
    It will also create 6 themes that are featured with random authors.
    """
    if not pytestconfig.option.usingliveserver:
        return

    owner = UserProfile.objects.get(username='******')
    generate_themes(6, owner)
    for _ in range(6):
        addon = addon_factory(status=STATUS_PUBLIC, type=ADDON_PERSONA)
        generate_collection(addon, app=FIREFOX)
示例#12
0
def themes(transactional_db, create_superuser, pytestconfig):
    """Creates exactly 6 themes that will be not featured.

    These belong to the user created by the 'create_superuser' fixture.
    It will also create 6 themes that are featured with random authors.
    """
    if not pytestconfig.option.usingliveserver:
        return

    owner = UserProfile.objects.get(username='******')
    generate_themes(6, owner)
    for _ in range(6):
        addon = addon_factory(status=STATUS_PUBLIC, type=ADDON_PERSONA)
        generate_collection(addon, app=FIREFOX)
示例#13
0
    def create_featured_themes(self):
        """Creates exactly 6 themes that will be not featured.

        These belong to the user uitest.

        It will also create 6 themes that are featured with random authors.

        """
        for _ in range(6):
            addon = addon_factory(recommended=True,
                                  status=amo.STATUS_APPROVED,
                                  type=ADDON_STATICTHEME,
                                  file_kw={'is_webextension': True},
                                  version_kw={'nomination': days_ago(6)})
            generate_collection(addon, type=amo.COLLECTION_RECOMMENDED)
示例#14
0
    def create_featured_themes(self):
        """Creates exactly 6 themes that will be not featured.

        These belong to the user uitest.

        It will also create 6 themes that are featured with random authors.

        """
        for _ in range(6):
            addon = addon_factory(
                status=amo.STATUS_APPROVED,
                type=ADDON_STATICTHEME,
                version_kw={'nomination': days_ago(6)},
                promoted=RECOMMENDED,
            )
            generate_collection(addon)
示例#15
0
    def create_featured_android_addon(self):
        """Creates a custom addon named 'Ui-Addon-Android'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 2 reviews, and 1 authors.

        It is an Android addon.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        addon = addon_factory(
            status=STATUS_APPROVED,
            type=ADDON_EXTENSION,
            average_daily_users=5656,
            users=[self.user],
            average_rating=5,
            description=u'My Addon description about ANDROID',
            file_kw={
                'hash': 'fakehash',
                'platform': amo.PLATFORM_ANDROID.id,
                'size': 42,
            },
            guid=generate_addon_guid(),
            icon_type=random.choice(default_icons),
            name=u'Ui-Addon-Android',
            public_stats=True,
            slug='ui-test-addon-android',
            summary=u'My Addon summary for Android',
            tags=[
                'some_tag', 'another_tag', 'ui-testing', 'selenium', 'python',
                'android'
            ],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon for Android.',
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon,
                                 listed=True)
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print('Created addon {0} for testing successfully'.format(addon.name))
示例#16
0
    def create_featured_android_addon(self):
        """Creates a custom addon named 'Ui-Addon-Android'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 2 reviews, and 1 authors.

        It is an Android addon.

        """
        addon = addon_factory(
            status=amo.STATUS_APPROVED,
            type=ADDON_EXTENSION,
            average_daily_users=5656,
            users=[self.user],
            average_rating=5,
            description='My Addon description about ANDROID',
            file_kw={'is_webextension': True},
            guid=generate_addon_guid(),
            name='Ui-Addon-Android',
            slug='ui-test-addon-android',
            summary='My Addon summary for Android',
            tags=[
                'some_tag',
                'another_tag',
                'ui-testing',
                'selenium',
                'python',
                'android',
            ],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon for Android.',
            version_kw={'nomination': days_ago(6)},
            promoted=RECOMMENDED,
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon,
                                 listed=True)
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print('Created addon {0} for testing successfully'.format(addon.name))
示例#17
0
    def create_featured_android_addon(self):
        """Creates a custom addon named 'Ui-Addon-Android'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 2 reviews, and 1 authors.

        It is an Android addon.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        addon = addon_factory(
            status=STATUS_PUBLIC,
            type=ADDON_EXTENSION,
            average_daily_users=5656,
            users=[self.user],
            average_rating=5,
            description=u'My Addon description about ANDROID',
            file_kw={
                'hash': 'fakehash',
                'platform': amo.PLATFORM_ANDROID.id,
                'size': 42,
            },
            guid=generate_addon_guid(),
            icon_type=random.choice(default_icons),
            name=u'Ui-Addon-Android',
            public_stats=True,
            slug='ui-test-addon-android',
            summary=u'My Addon summary for Android',
            tags=['some_tag', 'another_tag', 'ui-testing',
                  'selenium', 'python', 'android'],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon for Android.',
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(user=user_factory(username='******'),
                                 addon=addon, listed=True)
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print(
            'Created addon {0} for testing successfully'
            .format(addon.name))
示例#18
0
    def create_featured_themes(self):
        """Creates exactly 6 themes that will be not featured.

        These belong to the user uitest.

        It will also create 6 themes that are featured with random authors.

        """
        for _ in range(6):
            addon = addon_factory(status=amo.STATUS_APPROVED,
                                  type=ADDON_PERSONA,
                                  file_kw={'is_webextension': True},
                                  version_kw={
                                      'recommendation_approved': True,
                                      'nomination': days_ago(6)
                                  })
            DiscoveryItem.objects.create(recommendable=True, addon=addon)
            generate_collection(addon, type=amo.COLLECTION_RECOMMENDED)
示例#19
0
def minimal_addon(transactional_db, create_superuser, pytestconfig):
    """Creates a custom addon named 'Ui-Addon-2'.

    It will belong to the user created by the 'create_superuser' fixture.

    It has 1 preview, and 2 reviews.
    """
    if not pytestconfig.option.usingliveserver:
        return

    default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
    addon = addon_factory(
        status=STATUS_PUBLIC,
        type=ADDON_EXTENSION,
        average_daily_users=7000,
        users=[UserProfile.objects.get(username='******')],
        average_rating=3,
        description=u'My Addon description',
        file_kw={
            'hash': 'fakehash',
            'platform': amo.PLATFORM_ALL.id,
            'size': 42,
        },
        guid=generate_addon_guid(),
        icon_type=random.choice(default_icons),
        name=u'Ui-Addon-2',
        public_stats=True,
        slug='ui-test-2',
        summary=u'My Addon summary',
        tags=['some_tag', 'another_tag', 'ui-testing',
              'selenium', 'python'],
        total_reviews=777,
        weekly_downloads=22233879,
        developer_comments='This is a testing addon, used within pytest.',
    )
    Preview.objects.create(addon=addon, position=1)
    Review.objects.create(addon=addon, rating=5, user=user_factory())
    Review.objects.create(addon=addon, rating=3, user=user_factory())
    addon.reload()

    addon.save()
    generate_collection(addon, app=FIREFOX, type=amo.COLLECTION_FEATURED)
    print('Created addon {0} for testing successfully'.format(addon.name))
    return addon
示例#20
0
    def create_featured_addon_with_version(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number.

        """
        addon = addon_factory(
            status=amo.STATUS_APPROVED,
            type=ADDON_EXTENSION,
            average_daily_users=5000,
            users=[self.user],
            average_rating=5,
            description='My Addon description',
            guid=generate_addon_guid(),
            name='Ui-Addon',
            slug='ui-test-2',
            summary='My Addon summary',
            tags=['some_tag', 'another_tag', 'ui-testing', 'selenium', 'python'],
            total_ratings=500,
            weekly_downloads=9999999,
            developer_comments='This is a testing addon.',
            version_kw={'nomination': days_ago(6)},
            promoted=RECOMMENDED,
        )
        Preview.objects.create(addon=addon, position=1)
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        Rating.objects.create(addon=addon, rating=5, user=user_factory())
        AddonUser.objects.create(
            user=user_factory(username='******'), addon=addon, listed=True
        )
        addon.save()
        generate_collection(addon, app=FIREFOX)
        print(f'Created addon {addon.name} for testing successfully')
示例#21
0
    def create_featured_addon_with_version_for_install(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        try:
            addon = Addon.objects.get(guid='@webextension-guid')
        except Addon.DoesNotExist:
            addon = addon_factory(
                file_kw=False,
                average_daily_users=5000,
                users=[self.user],
                average_rating=5,
                description=u'My Addon description',
                guid='@webextension-guid',
                icon_type=random.choice(default_icons),
                name=u'Ui-Addon-Install',
                public_stats=True,
                slug='ui-test-install',
                summary=u'My Addon summary',
                tags=[
                    'some_tag', 'another_tag', 'ui-testing', 'selenium',
                    'python'
                ],
                weekly_downloads=9999999,
                developer_comments='This is a testing addon.',
                version_kw={
                    'recommendation_approved': True,
                    'nomination': days_ago(6)
                },
            )
            addon.save()
            generate_collection(addon, app=FIREFOX)
            DiscoveryItem.objects.create(recommendable=True, addon=addon)
            print('Created addon {0} for testing successfully'.format(
                addon.name))
        return addon
示例#22
0
def theme(transactional_db, create_superuser, pytestconfig):
    """Creates a custom theme named 'Ui-Test Theme'.

    This theme will be a featured theme and will belong to the user created by
    the 'create_superuser' fixture.

    It has one author.
    """
    if not pytestconfig.option.usingliveserver:
        return

    addon = addon_factory(
        status=STATUS_PUBLIC,
        type=ADDON_PERSONA,
        average_daily_users=4242,
        users=[UserProfile.objects.get(username='******')],
        average_rating=5,
        description=u'My UI Theme description',
        file_kw={
            'hash': 'fakehash',
            'platform': amo.PLATFORM_ALL.id,
            'size': 42,
        },
        guid=generate_addon_guid(),
        homepage=u'https://www.example.org/',
        name=u'Ui-Test Theme',
        public_stats=True,
        slug='ui-test',
        summary=u'My UI theme summary',
        support_email=u'*****@*****.**',
        support_url=u'https://support.example.org/support/ui-theme-addon/',
        tags=['some_tag', 'another_tag', 'ui-testing',
                'selenium', 'python'],
        total_reviews=777,
        weekly_downloads=123456,
        developer_comments='This is a testing theme, used within pytest.',
    )
    addon.save()
    generate_collection(addon, app=FIREFOX,
                        author=UserProfile.objects.get(username='******'))
    print('Created Theme {0} for testing successfully'.format(addon.name))
    return addon
示例#23
0
def theme(transactional_db, create_superuser, pytestconfig):
    """Creates a custom theme named 'Ui-Test Theme'.

    This theme will be a featured theme and will belong to the user created by
    the 'create_superuser' fixture.

    It has one author.
    """
    if not pytestconfig.option.usingliveserver:
        return

    addon = addon_factory(
        status=STATUS_PUBLIC,
        type=ADDON_PERSONA,
        average_daily_users=4242,
        users=[UserProfile.objects.get(username='******')],
        average_rating=4.21,
        description=u'My UI Theme description',
        file_kw={
            'hash': 'fakehash',
            'platform': amo.PLATFORM_ALL.id,
            'size': 42,
        },
        guid=generate_addon_guid(),
        homepage=u'https://www.example.org/',
        name=u'Ui-Test Theme',
        public_stats=True,
        slug='ui-test',
        summary=u'My UI theme summary',
        support_email=u'*****@*****.**',
        support_url=u'https://support.example.org/support/ui-theme-addon/',
        tags=['some_tag', 'another_tag', 'ui-testing',
                'selenium', 'python'],
        total_reviews=777,
        weekly_downloads=123456,
        developer_comments='This is a testing theme, used within pytest.',
    )
    addon.save()
    generate_collection(addon, app=FIREFOX,
                        author=UserProfile.objects.get(username='******'))
    print('Created Theme {0} for testing successfully'.format(addon.name))
    return addon
示例#24
0
    def create_featured_theme(self):
        """Creates a custom theme named 'Ui-Test Theme'.

        This theme will be a featured theme and will belong to the uitest user.

        It has one author.

        """
        addon = addon_factory(
            status=amo.STATUS_APPROVED,
            type=ADDON_PERSONA,
            average_daily_users=4242,
            users=[self.user],
            average_rating=5,
            description=u'My UI Theme description',
            file_kw={'is_webextension': True},
            guid=generate_addon_guid(),
            homepage=u'https://www.example.org/',
            name=u'Ui-Test Theme',
            public_stats=True,
            slug='ui-test',
            summary=u'My UI theme summary',
            support_email=u'*****@*****.**',
            support_url=u'https://support.example.org/support/ui-theme-addon/',
            tags=[
                'some_tag', 'another_tag', 'ui-testing', 'selenium', 'python'
            ],
            total_ratings=777,
            weekly_downloads=123456,
            developer_comments='This is a testing theme, used within pytest.',
            version_kw={
                'recommendation_approved': True,
                'nomination': days_ago(6)
            })
        addon.save()
        generate_collection(addon,
                            app=FIREFOX,
                            type=amo.COLLECTION_RECOMMENDED)
        DiscoveryItem.objects.create(recommendable=True, addon=addon)
        print('Created Theme {0} for testing successfully'.format(addon.name))
    def create_featured_theme(self):
        """Creates a custom theme named 'Ui-Test Theme'.

        This theme will be a featured theme and will belong to the uitest user.

        It has one author.

        """
        addon = addon_factory(
            status=STATUS_PUBLIC,
            type=ADDON_PERSONA,
            average_daily_users=4242,
            users=[self.user],
            average_rating=5,
            description=u'My UI Theme description',
            file_kw={
                'hash': 'fakehash',
                'platform': amo.PLATFORM_ALL.id,
                'size': 42,
            },
            guid=generate_addon_guid(),
            homepage=u'https://www.example.org/',
            name=u'Ui-Test Theme',
            public_stats=True,
            slug='ui-test',
            summary=u'My UI theme summary',
            support_email=u'*****@*****.**',
            support_url=u'https://support.example.org/support/ui-theme-addon/',
            tags=['some_tag', 'another_tag', 'ui-testing',
                    'selenium', 'python'],
            total_ratings=777,
            weekly_downloads=123456,
            developer_comments='This is a testing theme, used within pytest.',
        )
        addon.save()
        generate_collection(
            addon,
            app=FIREFOX,
            type=amo.COLLECTION_FEATURED)
        print('Created Theme {0} for testing successfully'.format(addon.name))
示例#26
0
    def create_featured_addon_with_version_for_install(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number.

        """
        default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
        try:
            addon = Addon.objects.get(guid='@webextension-guid')
        except Addon.DoesNotExist:
            addon = addon_factory(
                status=STATUS_PUBLIC,
                type=ADDON_EXTENSION,
                file_kw=False,
                average_daily_users=5000,
                users=[UserProfile.objects.get(username='******')],
                average_rating=5,
                description=u'My Addon description',
                guid='@webextension-guid',
                icon_type=random.choice(default_icons),
                name=u'Ui-Addon-Install',
                public_stats=True,
                slug='ui-test-install',
                summary=u'My Addon summary',
                tags=['some_tag', 'another_tag', 'ui-testing',
                      'selenium', 'python'],
                weekly_downloads=9999999,
                developer_comments='This is a testing addon.',
            )
            addon.save()
            generate_collection(addon, app=FIREFOX)
            print(
                'Created addon {0} for testing successfully'
                .format(addon.name))
        return addon
示例#27
0
    def create_featured_addon_with_version_for_install(self):
        """Creates a custom addon named 'Ui-Addon'.

        This addon will be a featured addon and will have a featured collecton
        attatched to it. It will belong to the user uitest.

        It has 1 preview, 5 reviews, and 2 authors. The second author is named
        'ui-tester2'. It has a version number.

        """
        try:
            addon = Addon.objects.get(guid='@webextension-guid')
        except Addon.DoesNotExist:
            addon = addon_factory(
                file_kw=False,
                average_daily_users=5000,
                users=[self.user],
                average_rating=5,
                description='My Addon description',
                guid='@webextension-guid',
                name='Ui-Addon-Install',
                slug='ui-test-install',
                summary='My Addon summary',
                tags=[
                    'some_tag', 'another_tag', 'ui-testing', 'selenium',
                    'python'
                ],
                weekly_downloads=9999999,
                developer_comments='This is a testing addon.',
                version_kw={'nomination': days_ago(6)},
                promoted=RECOMMENDED,
            )
            addon.save()
            generate_collection(addon, app=FIREFOX)
            print('Created addon {0} for testing successfully'.format(
                addon.name))
        return addon
示例#28
0
 def test_collections_themes_generation(self):
     generate_collection(self.addon)
     assert Collection.objects.all().count() == 1
     assert CollectionAddon.objects.last().addon == self.addon
     assert FeaturedCollection.objects.all().count() == 0
 def test_collections_themes_generation(self):
     generate_collection(self.addon)
     eq_(Collection.objects.all().count(), 1)
     eq_(CollectionAddon.objects.last().addon, self.addon)
     eq_(FeaturedCollection.objects.all().count(), 0)
 def test_collections_themes_translations(self):
     generate_collection(self.addon)
     with self.activate(locale='es'):
         collection_name = unicode(Collection.objects.last().name)
         ok_(collection_name.startswith(u'(español) '))
 def test_collections_addons_generation(self):
     generate_collection(self.addon, APPS['android'])
     eq_(Collection.objects.all().count(), 1)
     eq_(CollectionAddon.objects.last().addon, self.addon)
     eq_(FeaturedCollection.objects.last().application, APPS['android'].id)
示例#32
0
 def test_collections_themes_generation(self):
     generate_collection(self.addon)
     eq_(Collection.objects.all().count(), 1)
     eq_(CollectionAddon.objects.last().addon, self.addon)
     eq_(FeaturedCollection.objects.all().count(), 0)
示例#33
0
 def test_collections_themes_translations(self):
     generate_collection(self.addon)
     with self.activate(locale='es'):
         collection_name = six.text_type(Collection.objects.last().name)
         assert collection_name.startswith(u'(español) ')
示例#34
0
 def test_collections_themes_translations(self):
     generate_collection(self.addon)
     with self.activate(locale='es'):
         collection_name = unicode(Collection.objects.last().name)
         assert collection_name.startswith(u'(español) ')
示例#35
0
 def test_collections_addons_translations(self):
     generate_collection(self.addon, APPS['android'])
     with self.activate(locale='es'):
         collection_name = unicode(Collection.objects.last().name)
         assert collection_name.startswith(u'(español) ')
示例#36
0
 def test_collections_addons_generation(self):
     generate_collection(self.addon, APPS['android'])
     assert Collection.objects.all().count() == 1
     assert CollectionAddon.objects.last().addon == self.addon
     assert FeaturedCollection.objects.last().application == (
         APPS['android'].id)
示例#37
0
 def test_collections_themes_generation(self):
     generate_collection(self.addon)
     assert Collection.objects.all().count() == 1
     assert CollectionAddon.objects.last().addon == self.addon
     assert FeaturedCollection.objects.all().count() == 0
示例#38
0
 def test_collections_addons_generation(self):
     generate_collection(self.addon, APPS['android'])
     assert Collection.objects.all().count() == 1
     assert CollectionAddon.objects.last().addon == self.addon
     assert FeaturedCollection.objects.last().application == (
         APPS['android'].id)
示例#39
0
 def test_collections_addons_translations(self):
     generate_collection(self.addon, APPS['android'])
     with self.activate(locale='es'):
         collection_name = str(Collection.objects.last().name)
         assert collection_name.startswith(u'(español) ')
示例#40
0
 def test_collections_addons_generation(self):
     generate_collection(self.addon, APPS['android'])
     eq_(Collection.objects.all().count(), 1)
     eq_(CollectionAddon.objects.last().addon, self.addon)
     eq_(FeaturedCollection.objects.last().application, APPS['android'].id)