diff --git a/.github/workflows/windows-installer.yml b/.github/workflows/windows-installer.yml index a05b24925..95f4fc198 100644 --- a/.github/workflows/windows-installer.yml +++ b/.github/workflows/windows-installer.yml @@ -123,9 +123,9 @@ jobs: - name: Copy rece.ini file run: | copy conf\rece.ini . - - name: Test WSAA command line interface - run: | - .\wsaa.exe --analizar reingart.crt reingart.key wsmtxca 300 + # - name: Test WSAA command line interface + # run: | + # .\wsaa.exe --analizar reingart.crt reingart.key wsmtxca 300 - name: Register WSAA component run: | .\wsaa.exe --register @@ -144,16 +144,51 @@ jobs: run: | reg export "HKEY_CLASSES_ROOT\CLSID\{FA1BB90B-53D1-4FDA-8D1F-DEED2700E739}" wsfev1.reg type wsfev1.reg - - name: Test WSAA COM server automation + # - name: Test WSAA COM server automation + # run: | + # .\tests\test_wsaa.ps1 + # - name: Test WSFEv1 COM server automation + # run: | + # .\tests\test_wsfev1.ps1 + # - name: Test RECE1 command line interface tool + # run: | + # $env:Path += ";$pwd" + # . .\tests\test_rece1.ps1 + - name: List ejemplos directory + run: | + Get-ChildItem -Recurse .\ejemplos + + - name: Create dist folder if not exists run: | - .\tests\test_wsaa.ps1 - - name: Test WSFEv1 COM server automation + New-Item -ItemType Directory -Force -Path .\dist + + - name: Copy VBS files to dist folder + run: | + Copy-Item .\ejemplos\pyi25\pyi25.vbs .\dist\ -ErrorAction Continue -ErrorVariable copyErrors + if ($copyErrors) { + Write-Host "Error copying pyi25.vbs: $copyErrors" + } + Copy-Item .\ejemplos\pyqr\pyqr.vbs .\dist\ -ErrorAction Continue + Copy-Item .\ejemplos\factura_electronica.vbs .\dist\ -ErrorAction Continue + Copy-Item .\ejemplos\remito_electronico_carnico.vbs .\dist\ -ErrorAction Continue + Get-ChildItem .\dist + + - name: Test pyi25.vbs + run: | + .\tests\test_pyi25.ps1 + + - name: Test pyqr.vbs run: | - .\tests\test_wsfev1.ps1 - - name: Test RECE1 command line interface tool + .\tests\test_pyqr.ps1 + + - name: Test factura_electronica.vbs run: | - $env:Path += ";$pwd" - . .\tests\test_rece1.ps1 + .\tests\test_factura_electronica.ps1 + + - name: Test remito_electronico_carnico.vbs + run: | + .\tests\test_remito_electronico_carnico.ps1 + pre-release: name: "Pre Release" diff --git a/setup.py b/setup.py index f8d2a4e2d..1f1f170e5 100644 --- a/setup.py +++ b/setup.py @@ -19,14 +19,7 @@ import warnings import sys -try: - rev = subprocess.check_output( - ["git", "rev-list", "--count", "--all"], stderr=subprocess.PIPE - ).strip().decode("ascii") -except: - rev = 0 - -__version__ = "%s.%s.%s" % (sys.version_info[0:2] + (rev,)) +__version__ = "3.10.3028" HOMO = True diff --git a/setup_win.py b/setup_win.py index 7bfcd171f..8dd76f9d3 100644 --- a/setup_win.py +++ b/setup_win.py @@ -19,13 +19,9 @@ import warnings import sys -try: - rev = subprocess.check_output(['git', 'rev-list', '--count', '--all'], - stderr=subprocess.PIPE).strip().decode("ascii") -except: - rev = 0 -__version__ = "%s.%s.%s" % (sys.version_info[0:2] + (rev, )) +__version__ = "3.10.3028" + HOMO = True @@ -186,7 +182,6 @@ # add 32bit or 64bit tag to the installer name import platform -__version__ += "-" + platform.architecture()[0] # new webservices: @@ -196,7 +191,7 @@ if wsaa.TYPELIB: data_files.append(("typelib", ["typelib/wsaa.tlb"])) - __version__ += "+wsaa_" + wsaa.__version__ + HOMO &= wsaa.HOMO if 'wsfev1' in globals(): @@ -208,7 +203,7 @@ ] if wsfev1.TYPELIB: data_files.append(("typelib", ["typelib/wsfev1.tlb"])) - __version__ += "+wsfev1_" + wsfev1.__version__ + HOMO &= wsfev1.HOMO if 'wsfexv1' in globals(): @@ -219,7 +214,7 @@ Target(module=wsfexv1, script='wsfexv1.py', dest_base="wsfexv1_cli"), Target(module=recex1, script='recex1.py'), ] - __version__ += "+wsfexv1_" + wsfexv1.__version__ + HOMO &= wsfexv1.HOMO if 'wsbfev1' in globals(): @@ -230,7 +225,7 @@ Target(module=wsbfev1, script='wsbfev1.py', dest_base="wsbfev1_cli"), Target(module=receb1, script='receb1.py'), ] - __version__ += "+wsbfev1_" + wsbfev1.__version__ + HOMO &= wsbfev1.HOMO if 'wsmtx' in globals(): @@ -241,7 +236,7 @@ Target(module=wsmtx, script='wsmtx.py', dest_base="wsmtx_cli"), Target(module=recem, script='recem.py'), ] - __version__ += "+wsmtx_" + wsmtx.__version__ + HOMO &= wsmtx.HOMO if 'wsct' in globals(): @@ -252,7 +247,7 @@ Target(module=wsct, script='wsct.py', dest_base="wsct_cli"), Target(module=recet, script='recet.py'), ] - __version__ += "+wsct_" + wsct.__version__ + HOMO &= wsct.HOMO if 'wsfecred' in globals(): @@ -264,7 +259,7 @@ ] data_files += [ ] - __version__ += "+wsfecred_" + wsfecred.__version__ + HOMO &= wsfecred.HOMO if 'ws_sire' in globals(): @@ -276,7 +271,7 @@ ] data_files += [ ] - __version__ += "+sire_" + ws_sire.__version__ + HOMO &= ws_sire.HOMO if 'pyfepdf' in globals(): @@ -295,7 +290,7 @@ "plantillas/factura.csv", "plantillas/recibo.csv"]), ] - __version__ += "+pyfepdf_" + pyfepdf.__version__ + HOMO &= pyfepdf.HOMO if 'pyemail' in globals(): @@ -310,7 +305,7 @@ ] data_files += [ ] - __version__ += "+pyemail_" + pyemail.__version__ + if 'pyi25' in globals(): kwargs['com_server'] += [ @@ -322,9 +317,9 @@ kwargs['windows'] += [ Target(module=pyi25, script="pyi25.py", dest_base="pyi25_com"), ] - data_files += [ - ] - __version__ += "+pyi25_" + pyi25.__version__ + data_files += [(".", ["ejemplos/pyi25/pyi25.vbs"])] + + if 'pyqr' in globals(): kwargs['com_server'] += [ @@ -338,7 +333,7 @@ ] data_files += [ ] - __version__ += "+pyqr_" + pyqr.__version__ + if 'wsctg' in globals(): kwargs['com_server'] += [ @@ -347,7 +342,7 @@ kwargs['console'] += [ Target(module=wsctg, script='wsctg.py', dest_base="wsctg_cli"), ] - __version__ += "+wsctgv4_" + wsctg.__version__ + HOMO &= wsctg.HOMO if 'wslpg' in globals(): @@ -368,7 +363,7 @@ "plantillas/liquidacion_wslpg_ajuste_debcred.png", ]), ] - __version__ += "+wslpg_" + wslpg.__version__ + HOMO &= wslpg.HOMO if 'wsltv' in globals(): @@ -383,7 +378,7 @@ ("plantillas", [ ]), ] - __version__ += "+wsltv_" + wsltv.__version__ + HOMO &= wsltv.HOMO if 'wslum' in globals(): @@ -396,7 +391,7 @@ data_files += [ ("conf", ["conf/wslum.ini"]), ] - __version__ += "+wslum_" + wslum.__version__ + HOMO &= wslum.HOMO if 'wslsp' in globals(): @@ -409,7 +404,7 @@ data_files += [ ("conf", ["conf/wslsp.ini"]), ] - __version__ += "+wslsp_" + wslsp.__version__ + HOMO &= wslsp.HOMO if 'wsremcarne' in globals(): @@ -422,7 +417,7 @@ data_files += [ ("conf", ["conf/wsremcarne.ini"]), ] - __version__ += "+wsremcarne_" + wsremcarne.__version__ + HOMO &= wsremcarne.HOMO if 'wsremharina' in globals(): @@ -435,7 +430,7 @@ data_files += [ ("conf", ["conf/wsremharina.ini"]), ] - __version__ += "+wsremharina_" + wsremharina.__version__ + HOMO &= wsremharina.HOMO if 'wsremazucar' in globals(): @@ -448,7 +443,7 @@ data_files += [ ("conf", ["conf/wsremazucar.ini"]), ] - __version__ += "+wsremazucar_" + wsremazucar.__version__ + HOMO &= wsremazucar.HOMO if 'wscoc' in globals(): @@ -458,7 +453,7 @@ kwargs['console'] += [ Target(module=wscoc, script='wscoc.py', dest_base="wscoc_cli"), ] - __version__ += "+wscoc_" + wscoc.__version__ + HOMO &= wscoc.HOMO if 'wscdc' in globals(): @@ -468,7 +463,7 @@ kwargs['console'] += [ Target(module=wscdc, script='wscdc.py', dest_base="wscdc_cli"), ] - __version__ += "+wscdc_" + wscdc.__version__ + HOMO &= wscdc.HOMO if 'ws_sr_padron' in globals(): @@ -478,7 +473,7 @@ kwargs['console'] += [ Target(module=ws_sr_padron, script='ws_sr_padron.py', dest_base="ws_sr_padron_cli"), ] - __version__ += "+ws_sr_padron_" + ws_sr_padron.__version__ + HOMO &= ws_sr_padron.HOMO if 'cot' in globals(): @@ -497,7 +492,7 @@ "datos/TB_20111111112_000000_20101229_000001.txt", "datos/TB_20111111112_000000_20101229_000001.xml", ]), ("conf", ["conf/arba.crt"])] - __version__ += "+cot_" + cot.__version__ + HOMO &= cot.HOMO if 'iibb' in globals(): @@ -508,7 +503,7 @@ Target(module=iibb, script='iibb.py', dest_base="iibb_cli") ] data_files += [("conf", ["conf/arba.crt"])] - __version__ += "+iibb_" + iibb.__version__ + HOMO &= iibb.HOMO if 'trazamed' in globals(): @@ -521,7 +516,7 @@ if trazamed.TYPELIB: kwargs['windows'] += [Target(module=trazamed, script="trazamed.py", dest_base="trazamed")] data_files.append((".", ["trazamed.tlb"])) - __version__ += "+trazamed_" + trazamed.__version__ + HOMO &= trazamed.HOMO if 'trazaprodmed' in globals(): @@ -531,7 +526,7 @@ kwargs['console'] += [ Target(module=trazaprodmed, script='trazaprodmed.py', dest_base="trazaprodmed_cli"), ] - __version__ += "+trazaprodmed_" + trazaprodmed.__version__ + HOMO &= trazaprodmed.HOMO if 'trazarenpre' in globals(): @@ -544,7 +539,7 @@ if trazarenpre.TYPELIB: kwargs['windows'] += [Target(module=trazarenpre, script="trazarenpre.py", dest_base="trazarenpre")] data_files.append((".", ["trazarenpre.tlb"])) - __version__ += "+trazarenpre_" + trazarenpre.__version__ + HOMO &= trazarenpre.HOMO if 'trazafito' in globals(): @@ -554,7 +549,7 @@ kwargs['console'] += [ Target(module=trazafito, script='trazafito.py', dest_base="trazafito_cli"), ] - __version__ += "+trazafito_" + trazafito.__version__ + HOMO &= trazafito.HOMO if 'trazavet' in globals(): @@ -564,7 +559,7 @@ kwargs['console'] += [ Target(module=trazavet, script='trazavet.py', dest_base="trazavet_cli"), ] - __version__ += "+trazavet_" + trazavet.__version__ + HOMO &= trazavet.HOMO if 'padron' in globals(): @@ -579,7 +574,7 @@ data_files += [(".", [ "padron.db", ])] - __version__ += "+padron_" + padron.__version__ + #HOMO &= padron.HOMO if 'sired' in globals(): @@ -589,7 +584,7 @@ kwargs['console'] += [ Target(module=sired, script='sired.py', dest_base="sired_cli"), ] - __version__ += "+sired_" + sired.__version__ + # custom installer: kwargs['cmdclass'] = {"py2exe": build_installer} @@ -607,7 +602,7 @@ pass # agrego tag de homologaciĆ³n (testing - modo evaluaciĆ³n): -__version__ += "-homo" if HOMO else "-full" + # agrego ejemplos ##if HOMO: diff --git a/tests/powershell/test_factura_electronica.ps1 b/tests/powershell/test_factura_electronica.ps1 new file mode 100644 index 000000000..831fa1015 --- /dev/null +++ b/tests/powershell/test_factura_electronica.ps1 @@ -0,0 +1,62 @@ +# test_factura_electronica.ps1 + +$ErrorActionPreference = "Stop" + +# Set the working directory to the root of the repository +Set-Location $PSScriptRoot\.. + +# Verify dependencies +if (-not (Test-Path ".\dist\factura_electronica.vbs")) { + Write-Error "factura_electronica.vbs not found in dist folder. Ensure all dependencies are installed." + exit 1 +} + +# Set execution policy for this script +try { + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force +} catch { + Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions." +} + +# Run the VBS script and capture its output +try { + $output = cscript //nologo .\dist\factura_electronica.vbs + $output | Out-File -FilePath "factura_electronica_output.log" +} catch { + Write-Error "Failed to execute factura_electronica.vbs: $_" + exit 1 +} + +# Check if the script executed successfully +if ($LASTEXITCODE -ne 0) { + Write-Error "factura_electronica.vbs failed to execute with exit code $LASTEXITCODE" + exit 1 +} + +# Test for expected output +$expectedOutputs = @( + "InstallDir", "Token", "Sign", "Ultimo comprobante:", "Resultado", + "CAE", "Numero de comprobante:", "ErrMsg", "Obs", "Reprocesar:", + "Reproceso:", "EmisionTipo:" +) + +foreach ($expected in $expectedOutputs) { + if ($output -notmatch $expected) { + Write-Error "Expected output not found: $expected" + exit 1 + } +} + +# Check for successful CAE solicitation +if ($output -notmatch "CAE: \d+") { + Write-Error "CAE not obtained successfully" + exit 1 +} + +# Check for successful result +if ($output -notmatch "Resultado: A") { + Write-Error "Invoice authorization not successful" + exit 1 +} + +Write-Host "All tests for factura_electronica.vbs passed successfully" diff --git a/tests/powershell/test_pyi25.ps1 b/tests/powershell/test_pyi25.ps1 new file mode 100644 index 000000000..7eab1ab2c --- /dev/null +++ b/tests/powershell/test_pyi25.ps1 @@ -0,0 +1,55 @@ +# test_pyi25.ps1 + +$ErrorActionPreference = "Stop" + +# Set the working directory to the root of the repository +Set-Location $PSScriptRoot\.. + +# Verify dependencies +if (-not (Test-Path ".\dist\pyi25.vbs")) { + Write-Error "pyi25.vbs not found in dist folder. Ensure all dependencies are installed." + exit 1 +} + +# Set execution policy for this script +try { + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force +} catch { + Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions." +} + +# Run the VBS script and capture its output +try { + $output = cscript //nologo .\dist\pyi25.vbs + $output | Out-File -FilePath "pyi25_output.log" +} catch { + Write-Error "Failed to execute pyi25.vbs: $_" + exit 1 +} + +# Check if the script executed successfully +if ($LASTEXITCODE -ne 0) { + Write-Error "pyi25.vbs failed to execute with exit code $LASTEXITCODE" + exit 1 +} + +# Test for expected output +if ($output -notmatch "Version" -or $output -notmatch "Barras" -or $output -notmatch "Listo!") { + Write-Error "Expected output not found in pyi25.vbs execution" + exit 1 +} + +# Check if the output file was created +if (-not (Test-Path ".\dist\barras.png")) { + Write-Error "Barcode image file was not created" + exit 1 +} + +Write-Host "Current directory: $(Get-Location)" +Write-Host "Contents of dist folder:" +Get-ChildItem .\dist +if (-not (Test-Path ".\dist\pyi25.vbs")) { + Write-Error "pyi25.vbs not found in dist folder. Ensure all dependencies are installed." + exit 1 +} + diff --git a/tests/powershell/test_pyqr.ps1 b/tests/powershell/test_pyqr.ps1 new file mode 100644 index 000000000..edafcfba4 --- /dev/null +++ b/tests/powershell/test_pyqr.ps1 @@ -0,0 +1,52 @@ +# test_pyqr.ps1 + +$ErrorActionPreference = "Stop" + +# Set the working directory to the root of the repository +Set-Location $PSScriptRoot\.. + +# Verify dependencies +if (-not (Test-Path ".\dist\pyqr.vbs")) { + Write-Error "pyqr.vbs not found in dist folder. Ensure all dependencies are installed." + exit 1 +} + +# Set execution policy for this script +try { + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force +} catch { + Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions." +} + +# Run the VBS script and capture its output +try { + $output = cscript //nologo .\dist\pyqr.vbs + $output | Out-File -FilePath "pyqr_output.log" +} catch { + Write-Error "Failed to execute pyqr.vbs: $_" + exit 1 +} + +# Check if the script executed successfully +if ($LASTEXITCODE -ne 0) { + Write-Error "pyqr.vbs failed to execute with exit code $LASTEXITCODE" + exit 1 +} + +# Test for expected output +if ($output -notmatch "CrearArchivo" -or $output -notmatch "GenerarImagen") { + Write-Error "Expected output not found in pyqr.vbs execution" + exit 1 +} + +# Extract the file paths from the output +$createdFile = ($output -split "`n" | Select-String "CrearArchivo").ToString().Trim() +$generatedImage = ($output -split "`n" | Select-String "GenerarImagen").ToString().Trim() + +# Check if the files were created +if (-not (Test-Path $createdFile) -or -not (Test-Path $generatedImage)) { + Write-Error "Expected files not created by pyqr.vbs" + exit 1 +} + +Write-Host "All tests for pyqr.vbs passed successfully" diff --git a/tests/powershell/test_remito_electronico_carnico.ps1 b/tests/powershell/test_remito_electronico_carnico.ps1 new file mode 100644 index 000000000..d2dba759e --- /dev/null +++ b/tests/powershell/test_remito_electronico_carnico.ps1 @@ -0,0 +1,68 @@ +# test_remito_electronico_carnico.ps1 + +$ErrorActionPreference = "Stop" + +# Set the working directory to the root of the repository +Set-Location $PSScriptRoot\.. + +# Verify dependencies +if (-not (Test-Path ".\dist\remito_electronico_carnico.vbs")) { + Write-Error "remito_electronico_carnico.vbs not found in dist folder. Ensure all dependencies are installed." + exit 1 +} + +# Set execution policy for this script +try { + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force +} catch { + Write-Warning "Failed to set execution policy. Script may fail if not run with appropriate permissions." +} + +# Run the VBS script and capture its output +try { + $output = cscript //nologo .\dist\remito_electronico_carnico.vbs + $output | Out-File -FilePath "remito_electronico_carnico_output.log" +} catch { + Write-Error "Failed to execute remito_electronico_carnico.vbs: $_" + exit 1 +} + +# Check if the script executed successfully +if ($LASTEXITCODE -ne 0) { + Write-Error "remito_electronico_carnico.vbs failed to execute with exit code $LASTEXITCODE" + exit 1 +} + +# Test for expected output +$expectedOutputs = @( + "InstallDir", "Token", "Sign", "Ultimo comprobante:", "Resultado:", + "Cod Remito:", "Numero Remito:", "Cod Autorizacion:", "Fecha Emision", + "Fecha Vencimiento", "Observaciones:", "Errores:", "Evento:" +) + +foreach ($expected in $expectedOutputs) { + if ($output -notmatch $expected) { + Write-Error "Expected output not found: $expected" + exit 1 + } +} + +# Check for successful remito generation +if ($output -notmatch "Resultado: A") { + Write-Error "Remito generation not successful" + exit 1 +} + +# Check for Cod Remito +if ($output -notmatch "Cod Remito: \d+") { + Write-Error "Cod Remito not obtained successfully" + exit 1 +} + +# Check if QR file was created +if (-not (Test-Path "qr.png")) { + Write-Error "QR code image file was not created" + exit 1 +} + +Write-Host "All tests for remito_electronico_carnico.vbs passed successfully"