From a0d7ae28bffe6b3b9ae9ebb850c705d1641888a2 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 13 Jan 2015 22:15:06 +0300 Subject: [PATCH] Simple tests for graph generation API. #169 --- system/t12_api/__init__.py | 3 ++- system/t12_api/graph.py | 17 +++++++++++++++++ system/t12_api/publish.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 system/t12_api/graph.py diff --git a/system/t12_api/__init__.py b/system/t12_api/__init__.py index b09d27a0..c8ba5645 100644 --- a/system/t12_api/__init__.py +++ b/system/t12_api/__init__.py @@ -5,4 +5,5 @@ Testing aptly REST API from .repos import * from .files import * from .publish import * -from .version import * \ No newline at end of file +from .version import * +from .graph import * diff --git a/system/t12_api/graph.py b/system/t12_api/graph.py new file mode 100644 index 00000000..2f2a9f10 --- /dev/null +++ b/system/t12_api/graph.py @@ -0,0 +1,17 @@ +from api_lib import APITest + + +class GraphAPITest(APITest): + """ + GET /graph.:ext + """ + + def check(self): + resp = self.get("/api/graph.png") + self.check_equal(resp.headers["Content-Type"], "image/png") + self.check_equal(resp.content[:4], '\x89PNG') + + self.check_equal(self.post("/api/repos", json={"Name": "xyz", "Comment": "fun repo"}).status_code, 201) + resp = self.get("/api/graph.svg") + self.check_equal(resp.headers["Content-Type"], "image/svg+xml") + self.check_equal(resp.content[:4], '