'Given there are some stopped containers and scale is called with a
desired number that is greater than the number of stopped containers,
test that those containers are restarted and required number are created.'

def test_scale_with_stopped_containers_and_needing_creation(self):

    service = self.create_service(u'web')
    next_number = service._next_container_number()
    service.create_container(number=next_number, quiet=True)
    for container in service.containers():
        self.assertFalse(container.is_running)
    with mock.patch(u'sys.stderr', new_callable=StringIO) as mock_stderr:
        service.scale(2)
    self.assertEqual(len(service.containers()), 2)
    for container in service.containers():
        self.assertTrue(container.is_running)
    captured_output = mock_stderr.getvalue()
    self.assertIn(u'Creating', captured_output)
    self.assertIn(u'Starting', captured_output)
