~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/tests/test_client.py

  • Committer: Curtis Hovey
  • Date: 2012-03-16 20:16:12 UTC
  • Revision ID: curtis.hovey@canonical.com-20120316201612-lr7b32umqgduaja6
Added a rudimentary put_archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        if parts[1] != 'archive':
142
142
            # This is an unknonwn operation?
143
143
            return
 
144
        if len(parts) == 3:
 
145
            # This expected path is /archive/archive_id.
 
146
            try:
 
147
                self.server.store.put_archive(parts[2])
 
148
                self.send_response(httplib.CREATED)
 
149
                self.end_headers()
 
150
                self.wfile.close()
 
151
            except:
 
152
                self.send_error(httplib.BAD_REQUEST)
144
153
        if len(parts) == 4:
145
154
            # This expected path is /archive/archive_id/message_id.
146
155
            try:
196
205
        self.logger.info(message)
197
206
 
198
207
 
 
208
class TestPutArchive(TestCase):
 
209
 
 
210
    def test_put_message(self):
 
211
        client = GrackleClient('localhost', 8410)
 
212
        message_archives = {}
 
213
        with ForkedFakeService.from_client(client, message_archives):
 
214
            client.put_archive('arch1')
 
215
            response = client.get_messages('arch1')
 
216
        self.assertEqual(0, len(response['messages']))
 
217
 
 
218
 
199
219
class TestPutMessage(TestCase):
200
220
 
201
221
    def test_put_message(self):