Skip to content

Commit

Permalink
Fix export test with yaml format
Browse files Browse the repository at this point in the history
Signed-off-by: ziad <ziadhany2016@gmail.com>
  • Loading branch information
ziadhany committed Jul 31, 2023
1 parent 1181ded commit 5597b71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vulnerabilities/management/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# See https://github.com/nexB/vulnerablecode for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
import yaml
from pathlib import Path

import yaml
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from packageurl import PackageURL
Expand Down
6 changes: 3 additions & 3 deletions vulnerabilities/tests/test_export.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
import os
from io import StringIO
from pathlib import Path
from unittest import TestCase

import pytest
import yaml
from django.core.management import call_command
from django.core.management.base import CommandError

Expand Down Expand Up @@ -102,10 +102,10 @@ def test_write_vuln_data(tmp_path, ecosystem, package, vuln_id, vuln_data):
package_dir = os.path.join(ecosystem_dir, package)
assert os.path.isdir(package_dir)

vuln_file = os.path.join(package_dir, vuln_id + ".json")
vuln_file = os.path.join(package_dir, vuln_id + ".yaml")
assert os.path.isfile(vuln_file)

assert Path(vuln_file).read_text() == json.dumps(vuln_data, ensure_ascii=False, indent=4)
assert Path(vuln_file).read_text() == yaml.dump(vuln_data)


class TestExportCommand(TestCase):
Expand Down

0 comments on commit 5597b71

Please sign in to comment.