Skip to content

Commit

Permalink
NXDRIVE-2889: Display system notification for document review -added …
Browse files Browse the repository at this point in the history
…testcase for EngineModel
  • Loading branch information
gitofanindya committed Jul 25, 2024
1 parent beb30a6 commit 96627a8
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 1 deletion.
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,106 @@ jobs:
SYSTEM_VERSION_COMPAT: 0
run: bash tools/osx/deploy_ci_agent.sh --check-upgrade

#
# Windows
#
- name: "[Windows] Unlock PowerShell"
if: matrix.os == 'windows-latest'
run: powershell Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine

- name: "[Windows] Setup the environment"
if: matrix.os == 'windows-latest'
run: powershell ".\\tools\\windows\\deploy_ci_agent.ps1" -install_release

- name: Setup Certificate
if: matrix.os == 'windows-latest'
run: |
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
cat /d/Certificate_pkcs12.p12
shell: bash

- name: Set variables
if: matrix.os == 'windows-latest'
id: variables
run: |
dir
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "KEYPAIR_NAME=gt-standard-keypair" >> $GITHUB_OUTPUT
echo "CERTIFICATE_NAME=gt-certificate" >> $GITHUB_OUTPUT
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
echo "SM_KEYPAIR_ALIAS=${{ secrets.SM_KEYPAIR_ALIAS }}" >> "$GITHUB_ENV"
echo "SM_CODE_SIGNING_CERT_SHA1_HASH=${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH
shell: bash

- name: Setup Keylocker KSP on windows
if: matrix.os == 'windows-latest'
run: |
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/Keylockertools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o Keylockertools-windows-x64.msi
msiexec /i Keylockertools-windows-x64.msi /quiet /qn
smksp_registrar.exe list
smctl.exe keypair ls
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
shell: cmd

- name: Certificates Sync
if: matrix.os == 'windows-latest'
run: |
smctl windows certsync --keypair-alias=${{ secrets.SM_KEYPAIR_ALIAS }}
shell: cmd

- name: Health status
if: matrix.os == 'windows-latest'
run: |
smctl healthcheck
shell: cmd


- name: "[Windows] Generate the .exe and validate against 2021"
timeout-minutes: 15
if: matrix.os == 'windows-latest'
env:
KEYCHAIN_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
NXDRIVE_TEST_NUXEO_URL: "https://drive-2021.beta.nuxeocloud.com/nuxeo"
SIGNING_ID: "Nuxeo"
SIGNTOOL_PATH: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86'
run: powershell ".\\tools\\windows\\deploy_ci_agent.ps1" -check_upgrade

- name: "[Windows] Generate the .exe and validate against 2023"
timeout-minutes: 15
if: matrix.os == 'windows-latest'
env:
NXDRIVE_TEST_NUXEO_URL: "https://drive-2023.beta.nuxeocloud.com/nuxeo"
NXDRIVE_TEST_USERNAME: ${{ secrets.NXDRIVE_2023_TEST_USERNAME }}
NXDRIVE_TEST_PASSWORD: ${{ secrets.NXDRIVE_2023_TEST_PASSWORD }}
SIGNING_ID: "Nuxeo"
SIGNTOOL_PATH: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86'
run: powershell ".\\tools\\windows\\deploy_ci_agent.ps1" -check_upgrade

- name: "[Windows] Generate and sign the .exe"
timeout-minutes: 15
if: matrix.os == 'windows-latest' && github.event.inputs.signExe == 'true'
env:
KEYCHAIN_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
SIGNING_ID_NEW: "Hyland Software, Inc."
SIGNTOOL_PATH: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86'
run: powershell ".\\tools\\windows\\deploy_ci_agent.ps1" -build_installer_and_sign

- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: package-distributions-${{ matrix.os }}
path: |
./dist/*.exe
./dist/*.dmg
./dist/*.AppImage
if-no-files-found: error

deploy:
runs-on: ubuntu-latest
needs: [release]
Expand Down
44 changes: 43 additions & 1 deletion tests/unit/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
from typing import Any, List
from unittest.mock import Mock

from nxdrive.gui.view import FileModel, TasksModel
import pytest

from nxdrive.client.workflow import Workflow
from nxdrive.gui.application import Application
from nxdrive.gui.view import EngineModel, FileModel, TasksModel
from nxdrive.qt.imports import QModelIndex
from nxdrive.translator import Translator
from nxdrive.utils import find_resource
Expand Down Expand Up @@ -79,3 +83,41 @@ def translate(message: str, /, *, values: List[Any] = None) -> str:

dummy_task_list = [dummy_task2]
assert not tasks_model.loadList(dummy_task_list, "Administrator")


@pytest.fixture()
def workflow():
return Workflow()


@pytest.fixture()
def application(manager_factory, workflow):
manager = manager_factory()
application = Mock(spec=Application)
application.manager = manager
application._init_translator = Mock()
application.setWindowIcon = Mock()
application.setApplicationName = Mock()
application.setQuitOnLastWindowClosed = Mock()
application.show_metrics_acceptance = Mock()
application.init_checks = Mock()
application._setup_notification_center = Mock()
application.workflow = workflow

return application


def test_engine_model():
application_ = application
application_.api = Mock()
application_.update_workflow = Mock()
application_.update_workflow_user_engine_list = Mock()
application_.manager = Mock()
application_.manager.engines = {"dummy_uid": "dummy_engine"}
engine_model = EngineModel(application_)
engine_model.beginInsertRows = Mock()
engine_model.endInsertRows = Mock()
engine_model._connect_engine = Mock()
engine_model.removeRows = Mock()
assert not engine_model.addEngine("dummy_uid")
assert not engine_model.removeEngine("dummy_uid")

0 comments on commit 96627a8

Please sign in to comment.