def test_main(monkeypatch): incomplete_args = [ '--package-name', 'org.mozilla.fennec_aurora', '--track', 'alpha', '--service-account', '*****@*****.**', ] monkeypatch.setattr(sys, 'argv', incomplete_args) with pytest.raises(SystemExit): main() file = os.path.join(os.path.dirname(__file__), 'data', 'blob') fail_manual_validation_args = [ 'script', '--track', 'rollout', '--service-account', '*****@*****.**', '--credentials', file, '--no-gp-string-update', '--skip-check-package-names', file ] with patch.object( mozapkpublisher.push_apk, 'push_apk', wraps=mozapkpublisher.push_apk.push_apk) as mock_push_apk: monkeypatch.setattr(sys, 'argv', fail_manual_validation_args) with pytest.raises(SystemExit): main() assert mock_push_apk.called
def test_main_amazon(monkeypatch): file = os.path.join(os.path.dirname(__file__), 'data', 'blob') fail_manual_validation_args = [ 'script', '--username', CLIENT_ID, '--secret', CLIENT_SECRET, 'amazon', file, '--expected-package-name=org.mozilla.fennec_aurora', ] with patch.object(mozapkpublisher.push_apk, 'push_apk') as mock_push_apk: monkeypatch.setattr(sys, 'argv', fail_manual_validation_args) main() mock_push_apk.assert_called_once_with( ANY, 'amazon', 'client', 'secret', ['org.mozilla.fennec_aurora'], None, None, True, True, False, False, False, False, )
def test_main_google(monkeypatch): file = os.path.join(os.path.dirname(__file__), 'data', 'blob') fail_manual_validation_args = [ 'script', '--username', '*****@*****.**', '--secret', file, 'google', 'alpha', file, '--expected-package-name=org.mozilla.fennec_aurora', ] with patch.object(mozapkpublisher.push_apk, 'push_apk') as mock_push_apk: monkeypatch.setattr(sys, 'argv', fail_manual_validation_args) main() mock_push_apk.assert_called_once_with( ANY, 'google', '*****@*****.**', file, ['org.mozilla.fennec_aurora'], 'alpha', None, True, True, False, False, False, False, )
def test_main(monkeypatch): incomplete_args = [ '--package-name', 'org.mozilla.fennec_aurora', '--track', 'alpha', '--service-account', '*****@*****.**', ] monkeypatch.setattr(sys, 'argv', incomplete_args) with pytest.raises(SystemExit): main()
def test_main_bad_arguments_status_code(monkeypatch): monkeypatch.setattr(sys, 'argv', ['script']) with pytest.raises(SystemExit) as exception: main() assert exception.value.code == 2