ElasticBeanstalk - Fix tests in Python2 and ServerMode

This commit is contained in:
Bert Blommers 2020-03-30 16:28:36 +01:00
parent 7d524eaec9
commit 551dc02459
3 changed files with 15 additions and 6 deletions

View File

@ -23,6 +23,7 @@ from moto.ec2 import ec2_backends
from moto.ec2_instance_connect import ec2_instance_connect_backends
from moto.ecr import ecr_backends
from moto.ecs import ecs_backends
from moto.elasticbeanstalk import eb_backends
from moto.elb import elb_backends
from moto.elbv2 import elbv2_backends
from moto.emr import emr_backends
@ -77,6 +78,7 @@ BACKENDS = {
"ec2_instance_connect": ec2_instance_connect_backends,
"ecr": ecr_backends,
"ecs": ecs_backends,
"elasticbeanstalk": eb_backends,
"elb": elb_backends,
"elbv2": elbv2_backends,
"events": events_backends,

View File

@ -1,6 +1,6 @@
import weakref
import boto.beanstalk
from boto3 import Session
from moto.core import BaseBackend, BaseModel
from .exceptions import InvalidParameterValueError, ResourceNotFoundException
@ -139,6 +139,14 @@ class EBBackend(BaseBackend):
raise KeyError()
eb_backends = dict(
(region.name, EBBackend(region.name)) for region in boto.beanstalk.regions()
)
eb_backends = {}
for region in Session().get_available_regions("elasticbeanstalk"):
eb_backends[region] = EBBackend(region)
for region in Session().get_available_regions(
"elasticbeanstalk", partition_name="aws-us-gov"
):
eb_backends[region] = EBBackend(region)
for region in Session().get_available_regions(
"elasticbeanstalk", partition_name="aws-cn"
):
eb_backends[region] = EBBackend(region)

View File

@ -50,8 +50,7 @@ class EBResponse(BaseResponse):
template = self.response_template(EB_DESCRIBE_ENVIRONMENTS)
return template.render(environments=envs,)
@staticmethod
def list_available_solution_stacks():
def list_available_solution_stacks(self):
return EB_LIST_AVAILABLE_SOLUTION_STACKS
def update_tags_for_resource(self):