Merge lp:~cjwatson/launchpad/queue-api-test-cleanups into lp:launchpad

Proposed by Colin Watson
Status: Merged
Approved by: j.c.sackett
Approved revision: no longer in the source branch.
Merged at revision: 15568
Proposed branch: lp:~cjwatson/launchpad/queue-api-test-cleanups
Merge into: lp:launchpad
Diff against target: 102 lines (+4/-55)
2 files modified
lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py (+0/-28)
lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py (+4/-27)
To merge this branch: bzr merge lp:~cjwatson/launchpad/queue-api-test-cleanups
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+113438@code.launchpad.net

Commit message

Stop relying on the queue tool in tests.

Description of the change

== Summary ==

In order to replace the queue tool with an API client, we'll need to ensure that Launchpad does not use that tool in its own test suite.

== Proposed fix ==

Test the model directly where appropriate (TestDistroSeriesQueueDistUpgrader.test_queue_tool_behaviour), and remove "queue fetch" tests which are adequately covered by tests added in https://code.launchpad.net/~cjwatson/launchpad/queue-api-readonly/+merge/113202.

== Tests ==

bin/test -vvct test_distroseriesqueue

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

This looks good to me, thanks for this clean up.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py'
2--- lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py 2012-05-25 13:28:31 +0000
3+++ lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py 2012-07-04 17:25:24 +0000
4@@ -27,10 +27,6 @@
5 getPolicy,
6 )
7 from lp.services.log.logger import DevNullLogger
8-from lp.soyuz.scripts.queue import (
9- CommandRunner,
10- name_queue_map,
11- )
12 from lp.soyuz.tests.test_publishing import TestNativePublishingBase
13 from lp.testing.gpgkeys import import_public_test_keys
14
15@@ -68,30 +64,6 @@
16 def test_accepts_correct_upload(self):
17 self.uploadTestData("20060728")
18
19- def runQueueCommand(self, queue_name, args):
20- def null_display(text):
21- pass
22-
23- queue = name_queue_map[queue_name]
24- runner = CommandRunner(
25- queue, "ubuntutest", "breezy-autotest", True, None, None, None,
26- display=null_display)
27- runner.execute(args)
28-
29- def test_queue_tool_behaviour(self):
30- # The queue tool can fetch ddtp-tarball uploads.
31- self.uploadTestData("20060728")
32- # Make sure that we can use the librarian files.
33- transaction.commit()
34- # Fetch upload into a temporary directory.
35- self.useTempDir()
36- self.runQueueCommand("accepted", ["fetch", "trans"])
37- expected_entries = [
38- "translations-main_20060728_all.changes",
39- "translations_main_20060728.tar.gz",
40- ]
41- self.assertContentEqual(expected_entries, os.listdir("."))
42-
43 def test_publish(self):
44 upload = self.uploadTestData("20060728")
45 transaction.commit()
46
47=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py'
48--- lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py 2012-07-03 10:29:53 +0000
49+++ lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py 2012-07-04 17:25:24 +0000
50@@ -23,10 +23,6 @@
51 )
52 from lp.services.config import config
53 from lp.services.log.logger import DevNullLogger
54-from lp.soyuz.scripts.queue import (
55- CommandRunner,
56- name_queue_map,
57- )
58 from lp.soyuz.tests.test_publishing import TestNativePublishingBase
59 from lp.testing.gpgkeys import import_public_test_keys
60
61@@ -69,37 +65,18 @@
62 def test_accepts_correct_upload(self):
63 self.uploadTestData("20060302.0120")
64
65- def runQueueCommand(self, queue_name, args):
66- def null_display(text):
67- pass
68-
69- queue = name_queue_map[queue_name]
70- runner = CommandRunner(
71- queue, "ubuntutest", "breezy-autotest", True, None, None, None,
72- display=null_display)
73- runner.execute(args)
74-
75- def test_queue_tool_behaviour(self):
76- # The queue tool can accept, reject, and fetch dist-upgrader
77- # uploads. See bug #54649.
78+ def test_accept_reject(self):
79+ # We can accept and reject dist-upgrader uploads.
80 upload = self.uploadTestData("20060302.0120")
81 # Make sure that we can use the librarian files.
82 transaction.commit()
83 # Reject from accepted queue (unlikely, would normally be from
84 # unapproved or new).
85- self.runQueueCommand("accepted", ["reject", "dist"])
86+ upload.queue_root.rejectFromQueue(logger=self.logger)
87 self.assertEqual("REJECTED", upload.queue_root.status.name)
88 # Accept from rejected queue (also unlikely, but only for testing).
89- self.runQueueCommand("rejected", ["accept", "dist"])
90+ upload.queue_root.acceptFromQueue(logger=self.logger)
91 self.assertEqual("ACCEPTED", upload.queue_root.status.name)
92- # Fetch upload into a temporary directory.
93- self.useTempDir()
94- self.runQueueCommand("accepted", ["fetch", "dist"])
95- expected_entries = [
96- "dist-upgrader_20060302.0120_all.changes",
97- "dist-upgrader_20060302.0120_all.tar.gz",
98- ]
99- self.assertContentEqual(expected_entries, os.listdir("."))
100
101 def test_bad_upload_remains_in_accepted(self):
102 # Bad dist-upgrader uploads remain in ACCEPTED.