def test_containers_with_containers(self):
    self.mock_client.containers.return_value = [dict(Name=str(i), Image='foo', Id=i) for i in range(3)]
    service = Service('db', self.mock_client, 'myproject', image='foo')
    assert ([c.id for c in service.containers()] == list(range(3)))
    expected_labels = ['{0}=myproject'.format(LABEL_PROJECT), '{0}=db'.format(LABEL_SERVICE), '{0}=False'.format(LABEL_ONE_OFF)]
    self.mock_client.containers.assert_called_once_with(all=False, filters={'label': expected_labels})
def test_containers_with_containers(self):
    self.mock_client.containers.return_value = [dict(Name=str(i), Image='foo', Id=i) for i in range(3)]
    service = Service('db', self.mock_client, 'myproject', image='foo')
    assert ([c.id for c in service.containers()] == list(range(3)))
    expected_labels = ['{0}=myproject'.format(LABEL_PROJECT), '{0}=db'.format(LABEL_SERVICE), '{0}=False'.format(LABEL_ONE_OFF)]
    self.mock_client.containers.assert_called_once_with(all=False, filters={'label': expected_labels})