Created
September 6, 2018 16:26
-
-
Save jrbenny35/9b9bcd55b03d19604f5629be9888ea97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/olympia/addons/management/commands/approve_addons.py b/src/olympia/addons/management/commands/approve_addons.py | |
index d77fc26806..e6d73b0b3d 100644 | |
--- a/src/olympia/addons/management/commands/approve_addons.py | |
+++ b/src/olympia/addons/management/commands/approve_addons.py | |
@@ -18,12 +18,21 @@ class Command(BaseCommand): | |
def add_arguments(self, parser): | |
parser.add_argument('addon_guid', nargs='+') | |
+ parser.add_argument( | |
+ '--accept-bulk-sign', | |
+ action='store_true', | |
+ dest='bulk_sign', | |
+ default=False, | |
+ help='Bulk sign addons', | |
+ ) | |
+ | |
def handle(self, *args, **options): | |
- confirm = raw_input( | |
- u'Are you sure you want to bulk approve and sign all those {0} ' | |
- u'addons? (yes/no)'.format(len(args))) | |
- if confirm != 'yes': | |
- raise CommandError(u'Aborted.') | |
+ if not options.get('bulk_sign', True): | |
+ confirm = raw_input( | |
+ u'Are you sure you want to bulk approve and sign all those {0} ' | |
+ u'addons? (yes/no)'.format(len(args))) | |
+ if confirm != 'yes': | |
+ raise CommandError(u'Aborted.') | |
for chunk in chunked(options['addon_guid'], 100): | |
files = get_files(chunk) | |
diff --git a/src/olympia/files/fixtures/files/ui-test_devhub_ext-1.0.xpi b/src/olympia/files/fixtures/files/ui-test_devhub_ext-1.0.xpi | |
index e989ec53ca..e9625bfa0e 100644 | |
Binary files a/src/olympia/files/fixtures/files/ui-test_devhub_ext-1.0.xpi and b/src/olympia/files/fixtures/files/ui-test_devhub_ext-1.0.xpi differ | |
diff --git a/tests/ui/conftest.py b/tests/ui/conftest.py | |
index 25b86c9904..049ae05120 100644 | |
--- a/tests/ui/conftest.py | |
+++ b/tests/ui/conftest.py | |
@@ -36,7 +36,7 @@ def firefox_options(firefox_options): | |
firefox_options.set_preference('extensions.webapi.testing', True) | |
firefox_options.set_preference('ui.popup.disable_autohide', True) | |
firefox_options.add_argument('-foreground') | |
- firefox_options.add_argument('-headless') | |
+ # firefox_options.add_argument('-headless') | |
firefox_options.log.level = 'trace' | |
return firefox_options | |
@@ -46,6 +46,15 @@ def firefox_notifications(notifications): | |
return notifications | |
+@pytest.fixture(scope='session') | |
+def django_db_setup(): | |
+ settings.DATABASES['default'] = { | |
+ 'ENGINE': 'django.db.backends.mysql', | |
+ 'HOST': 'db.example.com', | |
+ 'NAME': 'external_db', | |
+ } | |
+ | |
+ | |
@pytest.fixture( | |
scope='function', | |
params=[DESKTOP, MOBILE], | |
diff --git a/tests/ui/pages/desktop/devhub.py b/tests/ui/pages/desktop/devhub.py | |
index 383d2c5e37..ec163f3ed4 100644 | |
--- a/tests/ui/pages/desktop/devhub.py | |
+++ b/tests/ui/pages/desktop/devhub.py | |
@@ -1,3 +1,4 @@ | |
+from django.core.management import call_command | |
from pypom import Region | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as expected | |
@@ -88,6 +89,7 @@ class DevHub(Base): | |
self.selenium, self.base_url | |
).wait_for_page_to_load() | |
devhub_source.dont_submit_source_code() | |
+ | |
from pages.desktop.devhub_submission import DevhubSubmission | |
devhub = DevhubSubmission(self.selenium, self.base_url) | |
diff --git a/tests/ui/test_devhub.py b/tests/ui/test_devhub.py | |
index eb6201ec7b..96f5b84b4e 100644 | |
--- a/tests/ui/test_devhub.py | |
+++ b/tests/ui/test_devhub.py | |
@@ -1,6 +1,11 @@ | |
+import time | |
+ | |
+from django.core.management import call_command | |
import pytest | |
import requests | |
+from pages.desktop.details import Detail | |
+ | |
@pytest.mark.fxa_login | |
@pytest.mark.desktop_only | |
@@ -26,10 +31,32 @@ def test_devhub_addon_edit_link_works(base_url, selenium, devhub_login): | |
assert addon_name == addon_editor.name | |
+@pytest.mark.django_db | |
@pytest.mark.fxa_login | |
@pytest.mark.desktop_only | |
@pytest.mark.nondestructive | |
@pytest.mark.withoutresponses | |
def test_devhub_addon_upload(base_url, selenium, devhub_upload): | |
"""Test uploading an addon via devhub.""" | |
- 'ui-test-addon-2' in devhub_upload.addons[-1].name | |
+ 'ui-test_devhub_ext' in devhub_upload.addons[-1].name | |
+ | |
+ time.sleep(30) | |
+ call_command('approve_addons', | |
+ 'uitest_install@webextension-guid', | |
+ accept_bulk_sign=True) | |
+ time.sleep(15) | |
+ | |
+ selenium.get('{}/addon/{}'.format(base_url, 'ui-test_devhub_ext/')) | |
+ time.sleep(300) | |
+ addon = Detail(selenium, base_url) | |
+ assert 'UI-Test_devhub_ext' in addon.name | |
+ addon.install() | |
+ firefox.browser.wait_for_notification( | |
+ firefox_notifications.AddOnInstallBlocked | |
+ ).allow() | |
+ firefox.browser.wait_for_notification( | |
+ firefox_notifications.AddOnInstallConfirmation | |
+ ).install() | |
+ firefox.browser.wait_for_notification( | |
+ firefox_notifications.AddOnInstallComplete | |
+ ).close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment