Skip to content

Instantly share code, notes, and snippets.

@kkristof
Created September 18, 2012 09:25
Show Gist options
  • Save kkristof/3742227 to your computer and use it in GitHub Desktop.
Save kkristof/3742227 to your computer and use it in GitHub Desktop.
def test_next_patch(self):
queue = AbstractPatchQueue()
tool = MockTool()
queue.bind_to_tool(tool)
queue._options = Mock()
queue._options.port = None
self.assertEquals(queue._next_patch(), None)
tool.status_server = MockStatusServer(work_items=[2, 10000, 10001])
expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes.
expected_stderr = "MOCK: release_work_item: None 2\n"
patch = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_stderr=expected_stderr)
self.assertEquals(patch.id(), 10000) # 2 is an invalid patch id
self.assertEquals(queue._next_patch().id(), 10001)
self.assertEquals(queue._next_patch(), None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment