def test_get(self): with patch.object(self.client, 'fetch', autospec=True, return_value={123: {'X-GM-LABELS': ['foo', 'bar']}, 444: {'X-GM-LABELS': ['foo']}}): out = self.client.get_gmail_labels(sentinel.messages) self.client.fetch.assert_called_with(sentinel.messages, ['X-GM-LABELS']) self.assertEquals(out, {123: ['foo', 'bar'], 444: ['foo']})
def setUp(self): super(TestGmailLabels, self).setUp() patcher = patch.object(self.client, '_store', autospec=True, return_value=sentinel.label_set) patcher.start() self.addCleanup(patcher.stop)