summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Helmert III <ajak@gentoo.org>2024-01-21 19:25:35 -0800
committerJohn Helmert III <ajak@gentoo.org>2024-01-21 19:25:35 -0800
commit0dfe6c2bbe710e5db92c5620a365b551262dbbe7 (patch)
treec2f3cfbca5d267f573065301e75ff3ed19213f76
parenttest_views: more testing of reference invalidation (diff)
downloadglsamaker-0dfe6c2bbe710e5db92c5620a365b551262dbbe7.tar.gz
glsamaker-0dfe6c2bbe710e5db92c5620a365b551262dbbe7.tar.bz2
glsamaker-0dfe6c2bbe710e5db92c5620a365b551262dbbe7.zip
test -> glsamaker/tests
Signed-off-by: John Helmert III <ajak@gentoo.org>
-rw-r--r--.gitignore1
-rw-r--r--glsamaker/tests/conftest.py (renamed from test/conftest.py)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-39.mail (renamed from test/files/glsa/glsa-202107-39.mail)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-39.xml (renamed from test/files/glsa/glsa-202107-39.xml)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-48.mail (renamed from test/files/glsa/glsa-202107-48.mail)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-48.xml (renamed from test/files/glsa/glsa-202107-48.xml)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-55.mail (renamed from test/files/glsa/glsa-202107-55.mail)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-202107-55.xml (renamed from test/files/glsa/glsa-202107-55.xml)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-slotted-firefox.mail (renamed from test/files/glsa/glsa-slotted-firefox.mail)0
-rw-r--r--glsamaker/tests/files/glsa/glsa-slotted-firefox.xml (renamed from test/files/glsa/glsa-slotted-firefox.xml)0
-rw-r--r--glsamaker/tests/models/test_glsa.py (renamed from test/models/test_glsa.py)24
-rw-r--r--glsamaker/tests/models/test_package.py (renamed from test/models/test_package.py)0
-rw-r--r--glsamaker/tests/models/test_reference.py (renamed from test/models/test_reference.py)0
-rw-r--r--glsamaker/tests/test_autoglsa.py (renamed from test/test_autoglsa.py)0
-rw-r--r--glsamaker/tests/test_glsarepo.py (renamed from test/test_glsarepo.py)0
-rw-r--r--glsamaker/tests/test_views.py (renamed from test/test_views.py)0
-rw-r--r--glsamaker/tests/util.py (renamed from test/util.py)0
17 files changed, 13 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 3162d6a..3b80f22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,5 @@
.tox
build
etc
-glsa
glsamaker.egg-info
venv \ No newline at end of file
diff --git a/test/conftest.py b/glsamaker/tests/conftest.py
index 3acf994..3acf994 100644
--- a/test/conftest.py
+++ b/glsamaker/tests/conftest.py
diff --git a/test/files/glsa/glsa-202107-39.mail b/glsamaker/tests/files/glsa/glsa-202107-39.mail
index 93313fc..93313fc 100644
--- a/test/files/glsa/glsa-202107-39.mail
+++ b/glsamaker/tests/files/glsa/glsa-202107-39.mail
diff --git a/test/files/glsa/glsa-202107-39.xml b/glsamaker/tests/files/glsa/glsa-202107-39.xml
index 10bbe93..10bbe93 100644
--- a/test/files/glsa/glsa-202107-39.xml
+++ b/glsamaker/tests/files/glsa/glsa-202107-39.xml
diff --git a/test/files/glsa/glsa-202107-48.mail b/glsamaker/tests/files/glsa/glsa-202107-48.mail
index 43f1f8d..43f1f8d 100644
--- a/test/files/glsa/glsa-202107-48.mail
+++ b/glsamaker/tests/files/glsa/glsa-202107-48.mail
diff --git a/test/files/glsa/glsa-202107-48.xml b/glsamaker/tests/files/glsa/glsa-202107-48.xml
index 932918c..932918c 100644
--- a/test/files/glsa/glsa-202107-48.xml
+++ b/glsamaker/tests/files/glsa/glsa-202107-48.xml
diff --git a/test/files/glsa/glsa-202107-55.mail b/glsamaker/tests/files/glsa/glsa-202107-55.mail
index fb95032..fb95032 100644
--- a/test/files/glsa/glsa-202107-55.mail
+++ b/glsamaker/tests/files/glsa/glsa-202107-55.mail
diff --git a/test/files/glsa/glsa-202107-55.xml b/glsamaker/tests/files/glsa/glsa-202107-55.xml
index 0857f6a..0857f6a 100644
--- a/test/files/glsa/glsa-202107-55.xml
+++ b/glsamaker/tests/files/glsa/glsa-202107-55.xml
diff --git a/test/files/glsa/glsa-slotted-firefox.mail b/glsamaker/tests/files/glsa/glsa-slotted-firefox.mail
index 5733fa9..5733fa9 100644
--- a/test/files/glsa/glsa-slotted-firefox.mail
+++ b/glsamaker/tests/files/glsa/glsa-slotted-firefox.mail
diff --git a/test/files/glsa/glsa-slotted-firefox.xml b/glsamaker/tests/files/glsa/glsa-slotted-firefox.xml
index e414544..e414544 100644
--- a/test/files/glsa/glsa-slotted-firefox.xml
+++ b/glsamaker/tests/files/glsa/glsa-slotted-firefox.xml
diff --git a/test/models/test_glsa.py b/glsamaker/tests/models/test_glsa.py
index c17f042..8097b76 100644
--- a/test/models/test_glsa.py
+++ b/glsamaker/tests/models/test_glsa.py
@@ -1,4 +1,6 @@
+import os
import tempfile
+from pathlib import Path
import gnupg
from util import GPG_TEST_PASSPHRASE, SMTPUSER, assert_diff
@@ -9,6 +11,14 @@ from glsamaker.models.glsa import GLSA
from glsamaker.models.package import Affected
from glsamaker.models.reference import Reference
+GLSA_FILE_DIR = Path(os.path.dirname(__file__)) / ".." / "files" / "glsa"
+GLSAS = [
+ GLSA_FILE_DIR / "glsa-202107-39",
+ GLSA_FILE_DIR / "glsa-202107-48",
+ GLSA_FILE_DIR / "glsa-202107-55",
+ GLSA_FILE_DIR / "glsa-slotted-firefox",
+]
+
def test_get_bugs(db):
ids = ["1234", "4321", "1111", "2222"]
@@ -128,14 +138,6 @@ def test_get_references(db):
assert glsa.get_reference_texts() == sorted(cves)
-glsas = [
- "test/files/glsa/glsa-202107-39",
- "test/files/glsa/glsa-202107-48",
- "test/files/glsa/glsa-202107-55",
- "test/files/glsa/glsa-slotted-firefox",
-]
-
-
def striplines(lines):
return [line.strip() for line in lines]
@@ -149,7 +151,7 @@ def test_regenerate_xml(db):
# TODO: instead of diffing literal strings of XML, we should be
# diffing actual xml contents.. somehow. Currently, we're often
# testing for inconsequential whitespace differences
- for glsa_path in glsas:
+ for glsa_path in GLSAS:
xml_path = "{}.xml".format(glsa_path)
glsa = main.xml_to_glsa(xml_path)
db.session.merge(glsa)
@@ -159,7 +161,7 @@ def test_regenerate_xml(db):
def test_generate_mail_from_xml(db):
- for glsa_path in glsas:
+ for glsa_path in GLSAS:
xml_path = "{}.xml".format(glsa_path)
mail_path = "{}.mail".format(glsa_path)
glsa = main.xml_to_glsa(xml_path)
@@ -189,7 +191,7 @@ def test_generate_mail_signed(app, db, gpghome):
# Doesn't matter which GLSA we use here, we only need
# something that will generate the mail properly as we're not
# testing just how properly it's generated.
- glsa = main.xml_to_glsa(f"{glsas[0]}.xml")
+ glsa = main.xml_to_glsa(f"{GLSAS[0]}.xml")
db.session.merge(glsa)
generated_mail = glsa.generate_mail(
smtpuser=SMTPUSER,
diff --git a/test/models/test_package.py b/glsamaker/tests/models/test_package.py
index ba09a85..ba09a85 100644
--- a/test/models/test_package.py
+++ b/glsamaker/tests/models/test_package.py
diff --git a/test/models/test_reference.py b/glsamaker/tests/models/test_reference.py
index b07c7a6..b07c7a6 100644
--- a/test/models/test_reference.py
+++ b/glsamaker/tests/models/test_reference.py
diff --git a/test/test_autoglsa.py b/glsamaker/tests/test_autoglsa.py
index 7468547..7468547 100644
--- a/test/test_autoglsa.py
+++ b/glsamaker/tests/test_autoglsa.py
diff --git a/test/test_glsarepo.py b/glsamaker/tests/test_glsarepo.py
index f1f9bc9..f1f9bc9 100644
--- a/test/test_glsarepo.py
+++ b/glsamaker/tests/test_glsarepo.py
diff --git a/test/test_views.py b/glsamaker/tests/test_views.py
index 2b9f41f..2b9f41f 100644
--- a/test/test_views.py
+++ b/glsamaker/tests/test_views.py
diff --git a/test/util.py b/glsamaker/tests/util.py
index 440a3dd..440a3dd 100644
--- a/test/util.py
+++ b/glsamaker/tests/util.py