Best Python code snippet using localstack_python
test_domains.py
Source:test_domains.py
...3import sure # noqa4from moto import mock_swf_deprecated5# RegisterDomain endpoint6@mock_swf_deprecated7def test_register_domain():8 conn = boto.connect_swf("the_key", "the_secret")9 conn.register_domain("test-domain", "60", description="A test domain")10 all_domains = conn.list_domains("REGISTERED")11 domain = all_domains["domainInfos"][0]12 domain["name"].should.equal("test-domain")13 domain["status"].should.equal("REGISTERED")14 domain["description"].should.equal("A test domain")15@mock_swf_deprecated16def test_register_already_existing_domain():17 conn = boto.connect_swf("the_key", "the_secret")18 conn.register_domain("test-domain", "60", description="A test domain")19 conn.register_domain.when.called_with(20 "test-domain", "60", description="A test domain"21 ).should.throw(SWFResponseError)22@mock_swf_deprecated23def test_register_with_wrong_parameter_type():24 conn = boto.connect_swf("the_key", "the_secret")25 conn.register_domain.when.called_with(26 "test-domain", 60, description="A test domain"27 ).should.throw(SWFResponseError)28# ListDomains endpoint29@mock_swf_deprecated30def test_list_domains_order():31 conn = boto.connect_swf("the_key", "the_secret")32 conn.register_domain("b-test-domain", "60")33 conn.register_domain("a-test-domain", "60")34 conn.register_domain("c-test-domain", "60")35 all_domains = conn.list_domains("REGISTERED")36 names = [domain["name"] for domain in all_domains["domainInfos"]]37 names.should.equal(["a-test-domain", "b-test-domain", "c-test-domain"])38@mock_swf_deprecated39def test_list_domains_reverse_order():40 conn = boto.connect_swf("the_key", "the_secret")41 conn.register_domain("b-test-domain", "60")42 conn.register_domain("a-test-domain", "60")43 conn.register_domain("c-test-domain", "60")44 all_domains = conn.list_domains("REGISTERED", reverse_order=True)45 names = [domain["name"] for domain in all_domains["domainInfos"]]46 names.should.equal(["c-test-domain", "b-test-domain", "a-test-domain"])47# DeprecateDomain endpoint48@mock_swf_deprecated49def test_deprecate_domain():50 conn = boto.connect_swf("the_key", "the_secret")51 conn.register_domain("test-domain", "60", description="A test domain")52 conn.deprecate_domain("test-domain")53 all_domains = conn.list_domains("DEPRECATED")54 domain = all_domains["domainInfos"][0]55 domain["name"].should.equal("test-domain")56@mock_swf_deprecated57def test_deprecate_already_deprecated_domain():58 conn = boto.connect_swf("the_key", "the_secret")59 conn.register_domain("test-domain", "60", description="A test domain")60 conn.deprecate_domain("test-domain")61 conn.deprecate_domain.when.called_with(62 "test-domain"63 ).should.throw(SWFResponseError)64@mock_swf_deprecated65def test_deprecate_non_existent_domain():66 conn = boto.connect_swf("the_key", "the_secret")67 conn.deprecate_domain.when.called_with(68 "non-existent"69 ).should.throw(SWFResponseError)70# DescribeDomain endpoint71@mock_swf_deprecated72def test_describe_domain():73 conn = boto.connect_swf("the_key", "the_secret")74 conn.register_domain("test-domain", "60", description="A test domain")75 domain = conn.describe_domain("test-domain")76 domain["configuration"][77 "workflowExecutionRetentionPeriodInDays"].should.equal("60")78 domain["domainInfo"]["description"].should.equal("A test domain")79 domain["domainInfo"]["name"].should.equal("test-domain")80 domain["domainInfo"]["status"].should.equal("REGISTERED")81@mock_swf_deprecated82def test_describe_non_existent_domain():83 conn = boto.connect_swf("the_key", "the_secret")84 conn.describe_domain.when.called_with(85 "non-existent"...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!