Beispiel #1
0
 def _connect(self):
     if not self.conn:
         auth = MAASOAuth(*self.maas_api_key.split(':'))
         dispatcher = MAASDispatcher()
         self.maas_client = MAASClient(auth, dispatcher, self.maas_url)
         self.conn = True
Beispiel #2
0
def _getclient(url=u'http://localhost/MAAS/api/1.0/'):
    consumer_key, token, secret = key('root').split(':', 3)
    auth = MAASOAuth(consumer_key, token, secret)
    dispatch = MAASDispatcher()
    client = MAASClient(auth, dispatch, url)
    return client
Beispiel #3
0
 def test_dispatch_query_makes_direct_call(self):
     contents = factory.make_string().encode("ascii")
     url = "file://%s" % self.make_file(contents=contents)
     self.assertEqual(contents,
                      MAASDispatcher().dispatch_query(url, {}).read())