Esempio n. 1
0
 def test_min(self):
     pending_app = amo.tests.app_factory(
         status=amo.STATUS_PENDING,
         file_kw={'status': amo.STATUS_PENDING},
         version_kw={'nomination': self.days_ago(42)})
     pos = helpers.get_position(pending_app)
     eq_(pos['days'], 1)
Esempio n. 2
0
    def test_pending_app(self):
        # Took 8 days for some app to get reviewed.
        approved_app = amo.tests.app_factory()
        approved_app.latest_version.update(nomination=self.days_ago(10),
            reviewed=self.days_ago(2))

        # Add to the queue 2 pending apps for good measure.
        amo.tests.app_factory(status=amo.STATUS_PENDING).latest_version.update(
            nomination=self.days_ago(3))
        amo.tests.app_factory(status=amo.STATUS_PENDING).latest_version.update(
            nomination=self.days_ago(1))

        pending_app = amo.tests.app_factory(status=amo.STATUS_PENDING)
        pending_app.latest_version.update(nomination=self.days_ago(2))

        pos = helpers.get_position(pending_app)

        # It took 12 days for 2 apps to get reviewed, giving us an average of
        # 6 days to go from pending->public, but we've already waited 2 days.
        eq_(pos['days'], 4.0)

        # There is one pending app in front of us.
        eq_(pos['pos'], 2)

        # There are three pending apps.
        eq_(pos['total'], 3)
Esempio n. 3
0
 def test_min(self):
     pending_app = amo.tests.app_factory(
         status=amo.STATUS_PENDING,
         file_kw={'status': amo.STATUS_PENDING},
         version_kw={'nomination': self.days_ago(42)})
     pos = helpers.get_position(pending_app)
     eq_(pos['days'], 1)
Esempio n. 4
0
 def test_min(self):
     pending_app = amo.tests.app_factory(
         status=amo.STATUS_PENDING,
         file_kw={"status": amo.STATUS_PENDING},
         version_kw={"nomination": self.days_ago(42)},
     )
     pos = helpers.get_position(pending_app)
     eq_(pos["days"], 1)
Esempio n. 5
0
def version_list(request, addon_id, addon):
    qs = addon.versions.order_by('-created').transform(Version.transformer)
    versions = amo.utils.paginate(request, qs)
    new_file_form = forms.NewVersionForm(None, addon=addon)

    data = {'addon': addon,
            'versions': versions,
            'new_file_form': new_file_form,
            'position': get_position(addon),
            'timestamp': int(time.time())}
    return jingo.render(request, 'devhub/versions/list.html', data)
Esempio n. 6
0
    def _test_position(self, app):
        app.latest_version.update(nomination=self.days_ago(2))
        pos = helpers.get_position(app)

        # We set the nomination to 2 days ago.
        eq_(pos["days_in_queue"], 2)

        # There are three pending apps.
        eq_(pos["total"], 3)

        # It took 12 days for 2 apps to get reviewed, giving us an average of
        # 6 days to go from pending->public, but we've already waited 2 days.
        eq_(pos["days"], 4)

        # There is one pending app in front of us.
        eq_(pos["pos"], 2)
Esempio n. 7
0
    def _test_position(self, app):
        app.latest_version.update(nomination=self.days_ago(2))
        pos = helpers.get_position(app)

        # We set the nomination to 2 days ago.
        eq_(pos['days_in_queue'], 2)

        # There are three pending apps.
        eq_(pos['total'], 3)

        # It took 12 days for 2 apps to get reviewed, giving us an average of
        # 6 days to go from pending->public, but we've already waited 2 days.
        eq_(pos['days'], 4)

        # There is one pending app in front of us.
        eq_(pos['pos'], 2)
Esempio n. 8
0
 def test_public_app(self):
     eq_(helpers.get_position(self.public_app), False)