def test_authorization(self):
        http_post_data = {}

        def _http_post(self, *args, **kwargs):
            http_post_data['args'] = args
            http_post_data['kwargs'] = kwargs

            return json.dumps({
                'private_token': 'abc123'
            }), {}

        self.service_class._http_post = _http_post

        account = HostingServiceAccount(service_name=self.service_name,
                                        username='myuser')
        service = account.service

        self.spy_on(service.client.http_post, call_fake=_http_post)

        self.assertFalse(account.is_authorized)

        service.authorize('myuser', 'mypass',
                          hosting_url='https://example.com')
        self.assertTrue(account.is_authorized)

        self.assertEqual(http_post_data['kwargs']['url'],
                         'https://example.com/session')
        self.assertIn('username', http_post_data['kwargs'])
        self.assertIn('password', http_post_data['kwargs'])
Initializes this class.
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/tests/test_rbgateway.py/ReviewBoardGatewayTests.test_authorization--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/query.py/NodeQueryData.__init__