def test_compose_minimal(self):
    SOURCE_1 = 'source-1'
    SOURCE_2 = 'source-2'
    DESTINATION = 'destinaton'
    RESOURCE = {'etag': 'DEADBEEF'}
    after = ({'status': http_client.OK}, RESOURCE)
    connection = _Connection(after)
    client = _Client(connection)
    bucket = _Bucket(client=client)
    source_1 = self._make_one(SOURCE_1, bucket=bucket)
    source_2 = self._make_one(SOURCE_2, bucket=bucket)
    destination = self._make_one(DESTINATION, bucket=bucket)
    destination.content_type = 'text/plain'
    destination.compose(sources=[source_1, source_2])
    self.assertEqual(destination.etag, 'DEADBEEF')
    SENT = {'sourceObjects': [{'name': source_1.name}, {'name': source_2.name}], 'destination': {'contentType': 'text/plain'}}
    kw = connection._requested
    self.assertEqual(len(kw), 1)
    self.assertEqual(kw[0]['method'], 'POST')
    self.assertEqual(kw[0]['path'], ('/b/name/o/%s/compose' % DESTINATION))
    self.assertEqual(kw[0]['data'], SENT)
def test_compose_minimal(self):
    SOURCE_1 = 'source-1'
    SOURCE_2 = 'source-2'
    DESTINATION = 'destinaton'
    RESOURCE = {'etag': 'DEADBEEF'}
    after = ({'status': http_client.OK}, RESOURCE)
    connection = _Connection(after)
    client = _Client(connection)
    bucket = _Bucket(client=client)
    source_1 = self._make_one(SOURCE_1, bucket=bucket)
    source_2 = self._make_one(SOURCE_2, bucket=bucket)
    destination = self._make_one(DESTINATION, bucket=bucket)
    destination.content_type = 'text/plain'
    destination.compose(sources=[source_1, source_2])
    self.assertEqual(destination.etag, 'DEADBEEF')
    SENT = {'sourceObjects': [{'name': source_1.name}, {'name': source_2.name}], 'destination': {'contentType': 'text/plain'}}
    kw = connection._requested
    self.assertEqual(len(kw), 1)
    self.assertEqual(kw[0]['method'], 'POST')
    self.assertEqual(kw[0]['path'], ('/b/name/o/%s/compose' % DESTINATION))
    self.assertEqual(kw[0]['data'], SENT)