~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/tests/test_client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-11 15:44:02 UTC
  • mto: (6.1.30 trunk)
  • mto: This revision was merged to the branch mainline in revision 45.
  • Revision ID: aaron@canonical.com-20120111154402-qi5nk23wwd7czvrj
Include next_memo, previous_memo in get_messages response.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        messages = [m for m in self.server.messages[archive] if 'message_ids'
70
70
                    not in parameters or m['message-id'] in
71
71
                    parameters['message_ids']]
72
 
        self.wfile.write(simplejson.dumps(messages))
 
72
        response = {
 
73
            'messages': messages,
 
74
            'next_memo': None,
 
75
            'previous_memo': None
 
76
            }
 
77
        self.wfile.write(simplejson.dumps(response))
73
78
 
74
79
 
75
80
def fake_grackle_service(client, messages=None):
99
104
             {'message-id': 'bar'}]}):
100
105
            response = client.get_messages('baz')
101
106
        self.assertEqual(['bar', 'foo'], sorted(m['message-id'] for m in
102
 
            response))
 
107
            response['messages']))
 
108
        self.assertIs(None, response['next_memo'])
 
109
        self.assertIs(None, response['previous_memo'])
103
110
 
104
111
    def test_get_messages_by_id(self):
105
112
        client = GrackleClient('localhost', 8437)
107
114
            {'baz':
108
115
            [{'message-id': 'foo'},
109
116
             {'message-id': 'bar'}]}):
110
 
            message, = client.get_messages('baz', message_ids=['foo'])
 
117
            response = client.get_messages('baz', message_ids=['foo'])
 
118
        message, = response['messages']
111
119
        self.assertEqual('foo', message['message-id'])