From 8655777bc04e4af5505c806888c4746d20a21aa2 Mon Sep 17 00:00:00 2001 From: Mauro Regli Date: Wed, 13 Sep 2023 09:15:13 +0200 Subject: [PATCH] Tests: Add Basic test for graph command --- system/requirements.txt | 1 + system/t13_graph/__init__.py | 3 +++ system/t13_graph/graph.py | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 system/t13_graph/__init__.py create mode 100644 system/t13_graph/graph.py diff --git a/system/requirements.txt b/system/requirements.txt index 39b43f156..fd1a229d1 100644 --- a/system/requirements.txt +++ b/system/requirements.txt @@ -4,3 +4,4 @@ requests-unixsocket python-swiftclient flake8 termcolor +pillow diff --git a/system/t13_graph/__init__.py b/system/t13_graph/__init__.py new file mode 100644 index 000000000..9c738a636 --- /dev/null +++ b/system/t13_graph/__init__.py @@ -0,0 +1,3 @@ +""" +Testing Aptly Graph Command +""" diff --git a/system/t13_graph/graph.py b/system/t13_graph/graph.py new file mode 100644 index 000000000..4dfe1617d --- /dev/null +++ b/system/t13_graph/graph.py @@ -0,0 +1,25 @@ +from PIL import Image +from lib import BaseTest + + +class GraphTest1(BaseTest): + """ + Test that graph is generated correctly and accessible at the specified output path. + """ + + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly publish snapshot -skip-signing snap1", + ] + runCmd = "aptly graph -output=graph.png -layout=horizontal" + + def check(self): + self.check_exists("graph.png") + + with Image.open("graph.png") as img: + (width, height) = img.size + # check is horizontal + self.check_gt(width, height) + img.verify()