Started on batch
This commit is contained in:
parent
b17136e36c
commit
bba6d23eae
6
moto/batch/__init__.py
Normal file
6
moto/batch/__init__.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
from .models import batch_backends
|
||||||
|
from ..core.models import base_decorator
|
||||||
|
|
||||||
|
batch_backend = batch_backends['us-east-1']
|
||||||
|
mock_batch = base_decorator(batch_backends)
|
3
moto/batch/exceptions.py
Normal file
3
moto/batch/exceptions.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
from moto.core.exceptions import RESTError
|
||||||
|
|
23
moto/batch/models.py
Normal file
23
moto/batch/models.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import boto3
|
||||||
|
from moto.core import BaseBackend, BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class BatchBackend(BaseBackend):
|
||||||
|
def __init__(self, region_name=None):
|
||||||
|
super(BatchBackend, self).__init__()
|
||||||
|
self.region_name = region_name
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
region_name = self.region_name
|
||||||
|
self.__dict__ = {}
|
||||||
|
self.__init__(region_name)
|
||||||
|
|
||||||
|
def create_compute_environment(self, compute_environment_name, type, state, compute_resources, service_role):
|
||||||
|
# implement here
|
||||||
|
return compute_environment_name, compute_environment_arn
|
||||||
|
# add methods from here
|
||||||
|
|
||||||
|
|
||||||
|
available_regions = boto3.session.Session().get_available_regions("batch")
|
||||||
|
batch_backends = {region: BatchBackend for region in available_regions}
|
14
moto/batch/responses.py
Normal file
14
moto/batch/responses.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
from moto.core.responses import BaseResponse
|
||||||
|
from .models import batch_backends
|
||||||
|
|
||||||
|
|
||||||
|
class BatchResponse(BaseResponse):
|
||||||
|
@property
|
||||||
|
def batch_backend(self):
|
||||||
|
return batch_backends[self.region]
|
||||||
|
|
||||||
|
# add methods from here
|
||||||
|
|
||||||
|
|
||||||
|
# add teampltes from here
|
11
tests/test_batch/test_batch.py
Normal file
11
tests/test_batch/test_batch.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import boto3
|
||||||
|
import sure # noqa
|
||||||
|
from moto import mock_batch
|
||||||
|
|
||||||
|
|
||||||
|
@mock_batch
|
||||||
|
def test_list():
|
||||||
|
# do test
|
||||||
|
pass
|
16
tests/test_batch/test_server.py
Normal file
16
tests/test_batch/test_server.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import sure # noqa
|
||||||
|
|
||||||
|
import moto.server as server
|
||||||
|
from moto import mock_batch
|
||||||
|
|
||||||
|
'''
|
||||||
|
Test the different server responses
|
||||||
|
'''
|
||||||
|
|
||||||
|
@mock_batch
|
||||||
|
def test_batch_list():
|
||||||
|
backend = server.create_backend_app("batch")
|
||||||
|
test_client = backend.test_client()
|
||||||
|
# do test
|
Loading…
x
Reference in New Issue
Block a user