Prepare SWF objects representations directly via json.dumps()

... instead of jinja2 templates that are absolutely not suited for this
purpose, and hard to test.
This commit is contained in:
Jean-Baptiste Barth 2015-10-01 21:09:39 +02:00
commit 9483355584
4 changed files with 164 additions and 107 deletions

View file

@ -3,6 +3,7 @@ from nose.tools import assert_raises
from sure import expect
from moto import mock_swf
from moto.swf.models import Domain
from moto.swf.exceptions import (
SWFUnknownResourceFault,
SWFDomainAlreadyExistsFault,
@ -11,6 +12,15 @@ from moto.swf.exceptions import (
)
# Models
def test_dict_representation():
domain = Domain("foo", "52")
domain.to_dict().should.equal({"name":"foo", "status":"REGISTERED"})
domain.description = "foo bar"
domain.to_dict()["description"].should.equal("foo bar")
# RegisterDomain endpoint
@mock_swf
def test_register_domain():
@ -53,7 +63,7 @@ def test_register_with_wrong_parameter_type():
ex.body["__type"].should.equal("com.amazonaws.swf.base.model#SerializationException")
# ListDomain endpoint
# ListDomains endpoint
@mock_swf
def test_list_domains_order():
conn = boto.connect_swf("the_key", "the_secret")