'Utility method to create two containers with the same ports on two
nodes.'

def _test_conflicting_ports(self, node1, node2):

    d = self.assertResponseCode('POST', '/configuration/containers', {u'node_uuid': node1, u'name': u'postgres', u'image': u'postgres', u'ports': [{u'internal': 5432, u'external': 54320}]}, CREATED)
    d.addCallback((lambda _: self.assertResult('POST', '/configuration/containers', {u'node_uuid': node2, u'name': u'another_postgres', u'image': u'postgres', u'ports': [{u'internal': 5432, u'external': 54320}]}, CONFLICT, {u'description': u'A    specified    external    port    is    already    in    use.'})))
    return d
