mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Fix and enable broken graph layout tests
This commit is contained in:
+22
-14
@@ -21,19 +21,27 @@ class GraphAPITest(APITest):
|
||||
self.check_equal(resp.headers["Content-Type"], "text/plain; charset=utf-8")
|
||||
self.check_equal(resp.content[:13], 'digraph aptly')
|
||||
|
||||
# make sure our default layout is horizontal
|
||||
default = self.get("/api/graph.svg").content
|
||||
horizontal = self.get("/api/graph.svg?layout=horizontal").content
|
||||
self.check_equal(default, horizontal)
|
||||
|
||||
# basic test of layout:
|
||||
# horizontal should be wider than vertical
|
||||
# vertical should be higher than horizontal
|
||||
vertical = self.get("/api/graph.svg?layout=vertical").content
|
||||
svgHWidth = ET.fromstring(horizontal).get('width').replace("pt","")
|
||||
svgHHeight = ET.fromstring(horizontal).get('height').replace("pt","")
|
||||
svgVWidth = ET.fromstring(vertical).get('width').replace("pt","")
|
||||
svgVHeight = ET.fromstring(vertical).get('height').replace("pt","")
|
||||
# horizontal should be wider than vertical
|
||||
# vertical should be higher than horizontal
|
||||
# for this to work we need at couple of repos
|
||||
tempRepos = [self.random_name() for r in range(3)]
|
||||
for repo in tempRepos:
|
||||
self.check_equal(self.post("/api/repos", json={"Name": repo, "Comment": "graph test repo"}).status_code, 201)
|
||||
|
||||
#self.check_gt(svgHWidth, svgVWidth)
|
||||
#self.check_gt(svgVHeight, svgHHeight)
|
||||
horizontal = self.get("/api/graph.svg?layout=horizontal").content
|
||||
vertical = self.get("/api/graph.svg?layout=vertical").content
|
||||
horizontalWidth = int(ET.fromstring(horizontal).get('width').replace("pt",""))
|
||||
horizontalHeight = int(ET.fromstring(horizontal).get('height').replace("pt",""))
|
||||
verticalWidth = int(ET.fromstring(vertical).get('width').replace("pt",""))
|
||||
verticalHeight = int(ET.fromstring(vertical).get('height').replace("pt",""))
|
||||
|
||||
self.check_gt(horizontalWidth, verticalWidth)
|
||||
self.check_gt(verticalHeight, horizontalHeight)
|
||||
|
||||
# make sure our default layout is horizontal
|
||||
self.check_equal(horizontal, self.get("/api/graph.svg").content)
|
||||
|
||||
# remove the repos again
|
||||
for repo in tempRepos:
|
||||
self.check_equal(self.delete("/api/repos/" + repo, params={"force": "1"}).status_code, 200)
|
||||
|
||||
Reference in New Issue
Block a user