コード例 #1
0
    def test_basic(self):
        assert not FileUpload.objects.exists()
        assert not ActivityLog.objects.filter(
            action=amo.LOG.ADD_VERSION.id).exists()
        old_version = self.addon.current_version

        self.build_mock.return_value = 'fake-locale'

        with freeze_time('2018-08-28 08:00'):
            self.migration_date = datetime.now()
            migrate_legacy_dictionary_to_webextension(self.addon)

        self.build_mock.assert_called_once_with(self.addon, mock.ANY)
        assert FileUpload.objects.exists()
        self.addon.reload()
        assert self.addon.target_locale == 'fake-locale'
        assert self.addon.current_version != old_version
        activity_log = ActivityLog.objects.filter(
            action=amo.LOG.ADD_VERSION.id).get()
        assert activity_log.arguments == [
            self.addon.current_version, self.addon
        ]

        assert self.addon.last_updated == self.migration_date

        current_file = self.addon.current_version.all_files[0]
        assert current_file.datestatuschanged == self.migration_date
        assert current_file.status == amo.STATUS_PUBLIC

        self.call_signing_mock.assert_called_with(current_file)
        assert current_file.cert_serial_num == 'abcdefg1234'
コード例 #2
0
ファイル: test_tasks.py プロジェクト: iamVP7/addons-server
    def test_basic(self):
        assert not FileUpload.objects.exists()
        assert not ActivityLog.objects.filter(
            action=amo.LOG.ADD_VERSION.id).exists()
        old_version = self.addon.current_version

        self.build_mock.return_value = 'fake-locale'

        with freeze_time('2018-08-28 08:00'):
            self.migration_date = datetime.now()
            migrate_legacy_dictionary_to_webextension(self.addon)

        self.build_mock.assert_called_once_with(self.addon, mock.ANY)
        assert FileUpload.objects.exists()
        self.addon.reload()
        assert self.addon.target_locale == 'fake-locale'
        assert self.addon.current_version != old_version
        activity_log = ActivityLog.objects.filter(
            action=amo.LOG.ADD_VERSION.id).get()
        assert activity_log.arguments == [
            self.addon.current_version, self.addon
        ]

        assert self.addon.last_updated == self.migration_date

        current_file = self.addon.current_version.all_files[0]
        assert current_file.datestatuschanged == self.migration_date
        assert current_file.status == amo.STATUS_PUBLIC

        self.call_signing_mock.assert_called_with(current_file)
        assert current_file.cert_serial_num == 'abcdefg1234'