Пример #1
0
    def test_sends_boot_images_to_server(self):
        self.useFixture(ConfigFixture({'tftp': {'root': self.make_dir()}}))
        self.set_maas_url()
        auth.record_api_credentials(':'.join(make_api_credentials()))
        image = make_boot_image_params()
        self.patch(tftppath, 'list_boot_images', Mock(return_value=[image]))
        self.patch(boot_images, "get_cluster_uuid")
        self.patch(MAASClient, 'post')

        report_boot_images.delay()

        args, kwargs = MAASClient.post.call_args
        self.assertItemsEqual([image], json.loads(kwargs['images']))
Пример #2
0
    def test_sends_boot_images_to_server(self):
        self.useFixture(ConfigFixture({'tftp': {'root': self.make_dir()}}))
        self.set_maas_url()
        auth.record_api_credentials(':'.join(make_api_credentials()))
        image = make_boot_image_params()
        self.patch(tftppath, 'list_boot_images', Mock(return_value=[image]))
        self.patch(boot_images, "get_cluster_uuid")
        self.patch(MAASClient, 'post')

        report_boot_images.delay()

        args, kwargs = MAASClient.post.call_args
        self.assertItemsEqual([image], json.loads(kwargs['images']))
Пример #3
0
 def set_api_credentials(self):
     record_api_credentials(':'.join(make_api_credentials()))
Пример #4
0
 def set_api_credentials(self):
     record_api_credentials(':'.join(make_api_credentials()))
Пример #5
0
 def test_get_recorded_api_credentials_returns_credentials_as_tuple(self):
     creds = make_api_credentials()
     auth.record_api_credentials(convert_tuple_to_string(creds))
     self.assertEqual(creds, auth.get_recorded_api_credentials())
Пример #6
0
 def test_record_api_credentials_records_credentials_string(self):
     creds_string = convert_tuple_to_string(make_api_credentials())
     auth.record_api_credentials(creds_string)
     self.assertEqual(creds_string,
                      cache.cache.get(auth.API_CREDENTIALS_CACHE_KEY))
Пример #7
0
 def test_periodic_probe_task_exits_with_not_enough_knowledge(self):
     mocked = self.patch(detect_module, 'determine_cluster_interfaces')
     record_api_credentials(None)
     periodic_probe_task()
     self.assertFalse(mocked.called)
Пример #8
0
 def test_get_recorded_api_credentials_returns_credentials_as_tuple(self):
     creds = make_api_credentials()
     auth.record_api_credentials(convert_tuple_to_string(creds))
     self.assertEqual(creds, auth.get_recorded_api_credentials())
Пример #9
0
 def test_record_api_credentials_records_credentials_string(self):
     creds_string = convert_tuple_to_string(make_api_credentials())
     auth.record_api_credentials(creds_string)
     self.assertEqual(
         creds_string, cache.cache.get(auth.API_CREDENTIALS_CACHE_KEY))