--- /dev/null
+name: windows-and-mac
+
+on: [push, pull_request_target]
+
+jobs:
+ windows:
+ name: windows
+ runs-on: [windows-latest]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install .
+
+ - name: Test with pytest
+ run: |
+ pip install pytest
+ pip install pytest-cov
+ python -m pytest tests --junit-xml pytest.xml
+
+ macOS:
+ name: macOS
+ runs-on: [macos-latest]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install .
+
+ - name: Test with pytest
+ run: |
+ pip install pytest
+ pip install pytest-cov
+ python -m pytest tests --junit-xml pytest.xml
\ No newline at end of file
#!/usr/bin/env python3
+import os
import subprocess
import shutil
import pytest
from pathlib import Path
+OS_NEWLINE = os.linesep
+
MASTER_PASSWORD = 'test'
-HEADER = 'url,username,password\n'
-IMPORT_CREDENTIAL = 'http://www.example.com,foo,bar\n'
-EXPECTED_EXPORT_OUTPUT = f'{HEADER}http://www.stealmylogin.com,test,test\n'
-EXPECTED_IMPORT_OUTPUT = EXPECTED_EXPORT_OUTPUT + IMPORT_CREDENTIAL
+HEADER = 'url,username,password'
+IMPORT_CREDENTIAL = 'http://www.example.com,foo,bar'
+EXPECTED_EXPORT_OUTPUT = [HEADER, 'http://www.stealmylogin.com,test,test']
+EXPECTED_IMPORT_OUTPUT = EXPECTED_EXPORT_OUTPUT + [IMPORT_CREDENTIAL]
@pytest.fixture
command = ["ffpass", mode, "-d", str(path)]
if mode == 'import':
- ffpass_input = HEADER + IMPORT_CREDENTIAL
+ ffpass_input = OS_NEWLINE.join([HEADER, IMPORT_CREDENTIAL])
else:
ffpass_input = None
return subprocess.run(command, stdout=subprocess.PIPE, input=ffpass_input, encoding='utf-8')
+def stdout_splitter(input_text):
+ return [x for x in input_text.splitlines() if x != ""]
+
+
def test_legacy_firefox_export(clean_profile):
r = run_ffpass('export', clean_profile('firefox-70'))
r.check_returncode()
- assert r.stdout == EXPECTED_EXPORT_OUTPUT
+ actual_export_output = stdout_splitter(r.stdout)
+ assert actual_export_output == EXPECTED_EXPORT_OUTPUT
def test_firefox_export(clean_profile):
r = run_ffpass('export', clean_profile('firefox-84'))
r.check_returncode()
- assert r.stdout == EXPECTED_EXPORT_OUTPUT
+ assert stdout_splitter(r.stdout) == EXPECTED_EXPORT_OUTPUT
def test_firefox_aes_export(clean_profile):
profile_path = clean_profile('firefox-146-aes')
r = run_ffpass('export', profile_path)
r.check_returncode()
- assert r.stdout == EXPECTED_EXPORT_OUTPUT
+ assert stdout_splitter(r.stdout) == EXPECTED_EXPORT_OUTPUT
def test_legacy_firefox(clean_profile):
r = run_ffpass('export', profile_path)
r.check_returncode()
- assert r.stdout == EXPECTED_IMPORT_OUTPUT
+ assert stdout_splitter(r.stdout) == EXPECTED_IMPORT_OUTPUT
def test_firefox(clean_profile):
r = run_ffpass('export', profile_path)
r.check_returncode()
- assert r.stdout == EXPECTED_IMPORT_OUTPUT
-
+ assert stdout_splitter(r.stdout) == EXPECTED_IMPORT_OUTPUT