'Testing whether the API returns the right JSON data if a channel is created'

@deferred(timeout=10)
def test_my_channel_endpoint_create(self):

    def verify_channel_created(body):
        channel_obj = self.session.lm.channel_manager._channel_list[0]
        self.assertEqual(channel_obj.name, post_data['name'])
        self.assertEqual(channel_obj.description, post_data['description'])
        self.assertEqual(channel_obj.mode, post_data['mode'])
        self.assertDictEqual(json.loads(body), {'added': channel_obj.channel_id})
    post_data = {'name': "John    Smit's    channel", 'description': "Video's    of    my    cat", 'mode': 'semi-open'}
    self.session.create_channel = self.create_fake_channel
    self.should_check_equality = False
    return self.do_request('channels/discovered', expected_code=200, expected_json=None, request_type='PUT', post_data=post_data).addCallback(verify_channel_created)
