コード例 #1
0
    def handle(self, *args, **options):
        self.stdout.write(
            'Loading service configuration from {location}'.format(
                location=str(SERVICE_CONFIGURATION_FILE)))

        try:
            refresh_service_configuration_data(SERVICE_CONFIGURATION_FILE)
            self.stdout.write(
                self.style.SUCCESS('Configuration loaded successfully'))

        except Exception as exc:
            self.stderr.write(
                self.style.ERROR(
                    'Configuration can not be loaded.\n{exc}'.format(exc=exc)))
コード例 #2
0
 def test_get_config_from_file(self):
     file_path = self.temp_file(json.dumps(self.configuration))
     refresh_service_configuration_data(file_path)
コード例 #3
0
 def test_get_config_from_relative_path(self):
     file_path = os.path.relpath(
         self.temp_file(json.dumps(self.configuration)))
     refresh_service_configuration_data(file_path)
コード例 #4
0
 def test_get_config_from_url(self, mock):
     mock.get("mocked://microservice.io/service.json",
              status_code=200,
              json=self.configuration)
     refresh_service_configuration_data(
         "mocked://microservice.io/service.json")