41
40
def test_instance_creation(self):
42
41
instance = model.Instance(
43
"id1", "running", "type", "id2", "dns1", "dns2", "ip1",
44
"ip2", "key", "ami", "time", "placement",
45
["prod1", "prod2"], "id3", "id4")
42
"id1", "running", "type", "id2", "dns1", "dns2", "key", "ami",
43
"time", "placement", ["prod1", "prod2"], "id3", "id4")
46
44
self.assertEquals(instance.instance_id, "id1")
47
45
self.assertEquals(instance.instance_state, "running")
48
46
self.assertEquals(instance.instance_type, "type")
49
47
self.assertEquals(instance.image_id, "id2")
50
48
self.assertEquals(instance.private_dns_name, "dns1")
51
49
self.assertEquals(instance.dns_name, "dns2")
52
self.assertEquals(instance.private_ip_address, "ip1")
53
self.assertEquals(instance.ip_address, "ip2")
54
50
self.assertEquals(instance.key_name, "key")
55
51
self.assertEquals(instance.ami_launch_index, "ami")
56
52
self.assertEquals(instance.launch_time, "time")
300
242
def test_terminate_instances(self):
302
243
class StubQuery(object):
304
def __init__(stub, action="", creds=None, endpoint=None,
244
def __init__(stub, action, creds, endpoint, other_params):
306
245
self.assertEqual(action, "TerminateInstances")
307
246
self.assertEqual(creds.access_key, "foo")
308
247
self.assertEqual(creds.secret_key, "bar")
309
248
self.assertEqual(
311
{"InstanceId.1": "i-1234", "InstanceId.2": "i-5678"})
249
{"InstanceId.1": "i-1234", "InstanceId.2": "i-5678"},
313
251
def submit(self):
314
252
return succeed(payload.sample_terminate_instances_result)
253
creds = AWSCredentials("foo", "bar")
254
endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)
255
ec2 = client.EC2Client(creds=creds, endpoint=endpoint,
256
query_factory=StubQuery)
257
d = ec2.terminate_instances("i-1234", "i-5678")
316
258
def check_transition(changes):
317
259
self.assertEqual([("i-1234", "running", "shutting-down"),
318
260
("i-5678", "shutting-down", "shutting-down")], sorted(changes))
320
creds = AWSCredentials("foo", "bar")
321
endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)
322
ec2 = client.EC2Client(creds=creds, endpoint=endpoint,
323
query_factory=StubQuery)
324
d = ec2.terminate_instances("i-1234", "i-5678")
325
261
d.addCallback(check_transition)
380
312
ramdisk_id=u"r-1234")
381
313
d.addCallback(self.check_parsed_run_instances)
383
def test_run_instances_with_subnet(self):
384
class StubQuery(object):
385
def __init__(stub, action="", creds=None, endpoint=None,
387
self.assertEqual(action, "RunInstances")
388
self.assertEqual(creds.access_key, "foo")
389
self.assertEqual(creds.secret_key, "bar")
392
{"ImageId": "ami-1234", "MaxCount": "2", "MinCount": "1",
393
"SecurityGroupId.1": u"sg-a72d9f92e", "KeyName": u"default",
394
"UserData": "Zm9v", "InstanceType": u"m1.small",
395
"Placement.AvailabilityZone": u"us-east-1b",
396
"KernelId": u"k-1234", "RamdiskId": u"r-1234",
397
"SubnetId": "subnet-a72d829f"})
401
payload.sample_run_instances_result)
403
creds = AWSCredentials("foo", "bar")
404
ec2 = client.EC2Client(creds, query_factory=StubQuery)
405
d = ec2.run_instances("ami-1234", 1, 2, security_group_ids=[u"sg-a72d9f92e"],
406
key_name=u"default", user_data=u"foo", instance_type=u"m1.small",
407
availability_zone=u"us-east-1b", kernel_id=u"k-1234",
408
ramdisk_id=u"r-1234", subnet_id="subnet-a72d829f")
409
d.addCallback(self.check_parsed_run_instances)
411
def test_run_instances_with_subnet_but_without_secgroup_id(self):
412
creds = AWSCredentials("foo", "bar")
413
ec2 = client.EC2Client(creds)
414
error = self.assertRaises(ValueError, ec2.run_instances, "ami-1234", 1, 2,
415
key_name=u"default", user_data=u"foo", instance_type=u"m1.small",
416
availability_zone=u"us-east-1b", kernel_id=u"k-1234",
417
ramdisk_id=u"r-1234", subnet_id="subnet-a72d829f")
420
"You must specify the security_group_ids with the subnet_id"
423
def test_run_instances_without_subnet_and_secgroups(self):
424
creds = AWSCredentials("foo", "bar")
425
ec2 = client.EC2Client(creds)
426
error = self.assertRaises(ValueError, ec2.run_instances, "ami-1234", 1, 2,
427
key_name=u"default", user_data=u"foo", instance_type=u"m1.small",
428
availability_zone=u"us-east-1b", kernel_id=u"k-1234",
429
ramdisk_id=u"r-1234")
432
("You must specify either the subnet_id and "
433
"security_group_ids or security_groups")
437
316
class EC2ClientSecurityGroupsTestCase(TXAWSTestCase):
526
395
d = ec2.describe_security_groups()
527
396
return d.addCallback(check_results)
529
def test_describe_security_groups_with_multiple_groups(self):
531
Several groups can be contained in a single ip permissions content, and
532
there are recognized by the group parser.
534
class StubQuery(object):
536
def __init__(stub, action="", creds=None, endpoint=None,
538
self.assertEqual(action, "DescribeSecurityGroups")
539
self.assertEqual(creds.access_key, "foo")
540
self.assertEqual(creds.secret_key, "bar")
541
self.assertEqual(other_params, {})
545
payload.sample_describe_security_groups_multiple_groups)
547
def check_results(security_groups):
548
self.assertEquals(len(security_groups), 1)
550
security_group = security_groups[0]
551
self.assertEquals(security_group.name, "web/ssh")
552
self.assertEquals([(pair.user_id, pair.group_name)
553
for pair in security_group.allowed_groups],
554
[("170723411662", "default"),
555
("175723011368", "test1")])
557
[(ip.ip_protocol, ip.from_port, ip.to_port, ip.cidr_ip)
558
for ip in security_group.allowed_ips],
559
[('tcp', 22, 22, '0.0.0.0/0'), ("tcp", 80, 80, "0.0.0.0/0")])
561
creds = AWSCredentials("foo", "bar")
562
ec2 = client.EC2Client(creds, query_factory=StubQuery)
563
d = ec2.describe_security_groups()
564
return d.addCallback(check_results)
566
398
def test_describe_security_groups_with_name(self):
568
400
L{EC2Client.describe_security_groups} optionally takes a list of
569
401
security group names to limit results to.
571
403
class StubQuery(object):
573
def __init__(stub, action="", creds=None, endpoint=None,
404
def __init__(stub, action, creds, endpoint, other_params=None):
575
405
self.assertEqual(action, "DescribeSecurityGroups")
576
406
self.assertEqual(creds.access_key, "foo")
577
407
self.assertEqual(creds.secret_key, "bar")
578
408
self.assertEqual(other_params, {"GroupName.1": "WebServers"})
580
409
def submit(self):
581
410
return succeed(payload.sample_describe_security_groups_result)
638
433
"GroupName": "WebServers",
639
434
"GroupDescription": "The group for the web server farm.",
642
436
def submit(self):
643
437
return succeed(payload.sample_create_security_group)
645
def check_result(id):
646
self.assertEquals(id, "sg-1a2b3c4d")
648
439
creds = AWSCredentials("foo", "bar")
649
440
ec2 = client.EC2Client(creds, query_factory=StubQuery)
650
441
d = ec2.create_security_group(
652
443
"The group for the web server farm.")
653
return d.addCallback(check_result)
655
def test_create_security_group_with_VPC(self):
656
class StubQuery(object):
658
def __init__(stub, action="", creds=None, endpoint=None,
660
self.assertEqual(action, "CreateSecurityGroup")
661
self.assertEqual(creds.access_key, "foo")
662
self.assertEqual(creds.secret_key, "bar")
663
self.assertEqual(other_params, {
664
"GroupName": "WebServers",
665
"GroupDescription": "The group for the web server farm.",
670
return succeed(payload.sample_create_security_group)
672
def check_result(id):
673
self.assertEquals(id, "sg-1a2b3c4d")
675
creds = AWSCredentials("foo", "bar")
676
ec2 = client.EC2Client(creds, query_factory=StubQuery)
677
d = ec2.create_security_group(
679
"The group for the web server farm.",
681
return d.addCallback(check_result)
683
def test_delete_security_group_using_name(self):
444
return self.assertTrue(d)
446
def test_delete_security_group(self):
685
448
L{EC2Client.delete_security_group} returns a C{Deferred} that
686
449
eventually fires with a true value, indicating the success of the
689
452
class StubQuery(object):
691
def __init__(stub, action="", creds=None, endpoint=None,
453
def __init__(stub, action, creds, endpoint, other_params=None):
693
454
self.assertEqual(action, "DeleteSecurityGroup")
694
455
self.assertEqual(creds.access_key, "foo")
695
456
self.assertEqual(creds.secret_key, "bar")
696
457
self.assertEqual(other_params, {
697
458
"GroupName": "WebServers",
700
460
def submit(self):
701
461
return succeed(payload.sample_delete_security_group)
793
513
"SourceSecurityGroupName": "AppServers",
794
514
"SourceSecurityGroupOwnerId": "123456789123",
798
return succeed(payload.sample_authorize_security_group)
800
creds = AWSCredentials("foo", "bar")
801
ec2 = client.EC2Client(creds, query_factory=StubQuery)
802
d = ec2.authorize_security_group(
803
group_name="WebServers", source_group_name="AppServers",
804
source_group_owner_id="123456789123")
805
return self.assertTrue(d)
807
def test_authorize_security_group_using_group_id(self):
808
class StubQuery(object):
810
def __init__(stub, action="", creds=None, endpoint=None,
812
self.assertEqual(action, "AuthorizeSecurityGroupIngress")
813
self.assertEqual(creds.access_key, "foo")
814
self.assertEqual(creds.secret_key, "bar")
815
self.assertEqual(other_params, {
816
"GroupId": "sg-a1b2c3d4e5f6",
817
"SourceSecurityGroupName": "AppServers",
818
"SourceSecurityGroupOwnerId": "123456789123",
822
return succeed(payload.sample_authorize_security_group)
824
creds = AWSCredentials("foo", "bar")
825
ec2 = client.EC2Client(creds, query_factory=StubQuery)
826
d = ec2.authorize_security_group(
827
group_id="sg-a1b2c3d4e5f6", source_group_name="AppServers",
828
source_group_owner_id="123456789123")
829
return self.assertTrue(d)
831
def test_authorize_security_group_without_group_id_and_group_name(self):
832
creds = AWSCredentials("foo", "bar")
833
ec2 = client.EC2Client(creds)
834
error = self.assertRaises(ValueError, ec2.authorize_security_group,
835
source_group_name="AppServers", source_group_owner_id="123456789123")
838
"You must specify either the group name of the group id.")
517
return succeed(payload.sample_authorize_security_group)
519
creds = AWSCredentials("foo", "bar")
520
ec2 = client.EC2Client(creds, query_factory=StubQuery)
521
d = ec2.authorize_security_group(
522
"WebServers", source_group_name="AppServers",
523
source_group_owner_id="123456789123")
524
return self.assertTrue(d)
840
526
def test_authorize_security_group_with_ip_permissions(self):
1582
1188
d.addCallback(self.assertFalse)
1585
def test_import_keypair(self):
1587
L{client.EC2Client.import_keypair} calls the C{ImportKeyPair} method
1588
with the given arguments, encoding the key material in base64, and
1589
returns a C{Keypair} instance.
1592
def check_parsed_import_keypair(keypair):
1593
self.assertEquals(keypair.name, "example-key-name")
1595
keypair.fingerprint,
1596
"1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f")
1597
self.assertEquals(keypair.material, material)
1599
class StubQuery(object):
1601
def __init__(stub, action="", creds=None, endpoint=None,
1603
self.assertEqual(action, "ImportKeyPair")
1604
self.assertEqual("foo", creds)
1607
{"KeyName": "example-key-name",
1608
"PublicKeyMaterial":
1609
"c3NoLWRzcyBBQUFBQjNOemFDMWtjM01BQUFDQkFQNmFjakFQeitUR"
1610
"jJkREtmZGlhcnp2cXBBcjhlbUl6UElBWUp6QXNoTFgvUTJCZ2tWc0"
1611
"42eGI2QUlIUGE1MUFtWXVieU5PYjMxeVhWS2FRQTF6L213SHZtRld"
1612
"LQ1ZFQ0wwPSkgdXNlckBob3N0"})
1615
return succeed(payload.sample_import_keypair_result)
1617
ec2 = client.EC2Client(creds="foo", query_factory=StubQuery)
1619
"ssh-dss AAAAB3NzaC1kc3MAAACBAP6acjAPz+TF2dDKfdiarzvqpAr8emIzPIAY"
1620
"JzAshLX/Q2BgkVsN6xb6AIHPa51AmYubyNOb31yXVKaQA1z/mwHvmFWKCVECL0=)"
1622
d = ec2.import_keypair("example-key-name", material)
1623
d.addCallback(check_parsed_import_keypair)
1627
1192
class EC2ErrorWrapperTestCase(TXAWSTestCase):
1733
1298
self.endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)
1735
1300
def test_init_minimum(self):
1736
query = client.Query(
1737
action="DescribeInstances", creds=self.creds,
1738
endpoint=self.endpoint)
1301
query = client.Query("DescribeInstances", self.creds, self.endpoint)
1739
1302
self.assertTrue("Timestamp" in query.params)
1740
1303
del query.params["Timestamp"]
1741
1304
self.assertEqual(
1743
1305
{"AWSAccessKeyId": "foo",
1744
1306
"Action": "DescribeInstances",
1307
"SignatureMethod": "HmacSHA256",
1745
1308
"SignatureVersion": "2",
1746
"Version": "2012-08-15"})
1309
"Version": "2008-12-01"},
1312
def test_init_requires_action(self):
1313
self.assertRaises(TypeError, client.Query)
1315
def test_init_requires_creds(self):
1316
self.assertRaises(TypeError, client.Query, None)
1748
1318
def test_init_other_args_are_params(self):
1749
query = client.Query(
1750
action="DescribeInstances", creds=self.creds,
1751
endpoint=self.endpoint, other_params={"InstanceId.0": "12345"},
1752
time_tuple=(2007, 11, 12, 13, 14, 15, 0, 0, 0))
1319
query = client.Query("DescribeInstances", self.creds, self.endpoint,
1320
{"InstanceId.0": "12345"},
1321
time_tuple=(2007,11,12,13,14,15,0,0,0))
1753
1322
self.assertEqual(
1755
1323
{"AWSAccessKeyId": "foo",
1756
1324
"Action": "DescribeInstances",
1757
1325
"InstanceId.0": "12345",
1326
"SignatureMethod": "HmacSHA256",
1758
1327
"SignatureVersion": "2",
1759
1328
"Timestamp": "2007-11-12T13:14:15Z",
1760
"Version": "2012-08-15"})
1762
def test_no_timestamp_if_expires_in_other_params(self):
1764
If Expires is present in other_params, Timestamp won't be added,
1765
since a request should contain either Expires or Timestamp, but
1768
query = client.Query(
1769
action="DescribeInstances", creds=self.creds,
1770
endpoint=self.endpoint,
1771
other_params={"Expires": "2007-11-12T13:14:15Z"})
1774
{"AWSAccessKeyId": "foo",
1775
"Action": "DescribeInstances",
1776
"SignatureVersion": "2",
1777
"Expires": "2007-11-12T13:14:15Z",
1778
"Version": "2012-08-15"})
1329
"Version": "2008-12-01"},
1332
def test_sorted_params(self):
1333
query = client.Query("DescribeInstances", self.creds, self.endpoint,
1335
time_tuple=(2007,11,12,13,14,15,0,0,0))
1337
("AWSAccessKeyId", "foo"),
1338
("Action", "DescribeInstances"),
1339
("SignatureMethod", "HmacSHA256"),
1340
("SignatureVersion", "2"),
1341
("Timestamp", "2007-11-12T13:14:15Z"),
1342
("Version", "2008-12-01"),
1344
], query.sorted_params())
1346
def test_encode_unreserved(self):
1347
all_unreserved = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1348
"abcdefghijklmnopqrstuvwxyz0123456789-_.~")
1349
query = client.Query("DescribeInstances", self.creds, self.endpoint)
1350
self.assertEqual(all_unreserved, query.encode(all_unreserved))
1352
def test_encode_space(self):
1353
"""This may be just "url encode", but the AWS manual isn't clear."""
1354
query = client.Query("DescribeInstances", self.creds, self.endpoint)
1355
self.assertEqual("a%20space", query.encode("a space"))
1357
def test_canonical_query(self):
1358
query = client.Query("DescribeInstances", self.creds, self.endpoint,
1359
{"fu n": "g/ames", "argwithnovalue":"",
1360
"InstanceId.1": "i-1234"},
1361
time_tuple=(2007,11,12,13,14,15,0,0,0))
1362
expected_query = ("AWSAccessKeyId=foo&Action=DescribeInstances"
1363
"&InstanceId.1=i-1234"
1364
"&SignatureMethod=HmacSHA256&SignatureVersion=2&"
1365
"Timestamp=2007-11-12T13%3A14%3A15Z&Version=2008-12-01&"
1366
"argwithnovalue=&fu%20n=g%2Fames")
1367
self.assertEqual(expected_query, query.canonical_query_params())
1369
def test_signing_text(self):
1370
query = client.Query("DescribeInstances", self.creds, self.endpoint,
1371
time_tuple=(2007,11,12,13,14,15,0,0,0))
1372
signing_text = ("GET\n%s\n/\n" % self.endpoint.host +
1373
"AWSAccessKeyId=foo&Action=DescribeInstances&"
1374
"SignatureMethod=HmacSHA256&SignatureVersion=2&"
1375
"Timestamp=2007-11-12T13%3A14%3A15Z&Version=2008-12-01")
1376
self.assertEqual(signing_text, query.signing_text())
1780
1378
def test_sign(self):
1781
query = client.Query(
1782
action="DescribeInstances", creds=self.creds,
1783
endpoint=self.endpoint,
1379
query = client.Query("DescribeInstances", self.creds, self.endpoint,
1784
1380
time_tuple=(2007, 11, 12, 13, 14, 15, 0, 0, 0))
1786
self.assertEqual("c0gbkemrGEJdqxWOl2UZYaygYiBLVjrpWBs7bTN7Ndo=",
1382
self.assertEqual("aDmLr0Ktjsmt17UJD/EZf6DrfKWT1JW0fq2FDUCOPic=",
1787
1383
query.params["Signature"])
1789
def test_old_sign(self):
1790
query = client.Query(
1791
action="DescribeInstances", creds=self.creds,
1792
endpoint=self.endpoint,
1793
time_tuple=(2007, 11, 12, 13, 14, 15, 0, 0, 0),
1794
other_params={"SignatureVersion": "1"})
1797
"7tWrIC5VYvXOjVE+roVoyDUt2Yw=", query.params["Signature"])
1799
def test_unsupported_sign(self):
1800
query = client.Query(
1801
action="DescribeInstances", creds=self.creds,
1802
endpoint=self.endpoint,
1803
time_tuple=(2007, 11, 12, 13, 14, 15, 0, 0, 0),
1804
other_params={"SignatureVersion": "0"})
1805
self.assertRaises(RuntimeError, query.sign)
1807
def test_submit_with_port(self):
1809
If the endpoint port differs from the default one, the Host header
1810
of the request will include it.
1812
self.addCleanup(setattr, client.Query, "get_page",
1813
client.Query.get_page)
1815
def get_page(query, url, **kwargs):
1816
self.assertEqual("example.com:99", kwargs["headers"]["Host"])
1817
return succeed(None)
1819
client.Query.get_page = get_page
1820
endpoint = AWSServiceEndpoint(uri="http://example.com:99/foo")
1821
query = client.Query(action="SomeQuery", creds=self.creds,
1827
1385
def test_submit_400(self):
1828
1386
"""A 4xx response status from EC2 should raise a txAWS EC2Error."""
1909
class SignatureTestCase(TXAWSTestCase):
1912
TXAWSTestCase.setUp(self)
1913
self.creds = AWSCredentials("foo", "bar")
1914
self.endpoint = AWSServiceEndpoint(uri=EC2_ENDPOINT_US)
1917
def test_encode_unreserved(self):
1918
all_unreserved = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1919
"abcdefghijklmnopqrstuvwxyz0123456789-_.~")
1920
signature = client.Signature(self.creds, self.endpoint, self.params)
1921
self.assertEqual(all_unreserved, signature.encode(all_unreserved))
1923
def test_encode_space(self):
1924
"""This may be just 'url encode', but the AWS manual isn't clear."""
1925
signature = client.Signature(self.creds, self.endpoint, self.params)
1926
self.assertEqual("a%20space", signature.encode("a space"))
1928
def test_encode_unicode(self):
1930
L{Signature.encode} accepts unicode strings and encode them un UTF-8.
1932
signature = client.Signature(self.creds, self.endpoint, self.params)
1935
signature.encode(u"f\N{LATIN SMALL LETTER E WITH ACUTE}e"))
1937
def test_canonical_query(self):
1938
signature = client.Signature(self.creds, self.endpoint, self.params)
1939
time_tuple = (2007, 11, 12, 13, 14, 15, 0, 0, 0)
1940
self.params.update({"AWSAccessKeyId": "foo",
1942
"argwithnovalue": "",
1943
"SignatureVersion": "2",
1944
"Timestamp": iso8601time(time_tuple),
1945
"Version": "2009-11-30",
1946
"Action": "DescribeInstances",
1947
"InstanceId.1": "i-1234"})
1948
expected_params = ("AWSAccessKeyId=foo&Action=DescribeInstances"
1949
"&InstanceId.1=i-1234"
1950
"&SignatureVersion=2&"
1951
"Timestamp=2007-11-12T13%3A14%3A15Z&Version=2009-11-30&"
1952
"argwithnovalue=&fu%20n=g%2Fames")
1954
expected_params, signature.get_canonical_query_params())
1956
def test_signing_text(self):
1957
signature = client.Signature(self.creds, self.endpoint, self.params)
1958
self.params.update({"AWSAccessKeyId": "foo",
1959
"SignatureVersion": "2",
1960
"Action": "DescribeInstances"})
1961
signing_text = ("GET\n%s\n/\n" % self.endpoint.host +
1962
"AWSAccessKeyId=foo&Action=DescribeInstances&" +
1963
"SignatureVersion=2")
1964
self.assertEqual(signing_text, signature.signing_text())
1966
def test_signing_text_with_non_default_port(self):
1968
The signing text uses the canonical host name, which includes
1969
the port number, if it differs from the default one.
1971
endpoint = AWSServiceEndpoint(uri="http://example.com:99/path")
1972
signature = client.Signature(self.creds, endpoint, self.params)
1973
self.params.update({"AWSAccessKeyId": "foo",
1974
"SignatureVersion": "2",
1975
"Action": "DescribeInstances"})
1976
signing_text = ("GET\n"
1979
"AWSAccessKeyId=foo&"
1980
"Action=DescribeInstances&"
1981
"SignatureVersion=2")
1982
self.assertEqual(signing_text, signature.signing_text())
1984
def test_old_signing_text(self):
1985
signature = client.Signature(self.creds, self.endpoint, self.params)
1986
self.params.update({"AWSAccessKeyId": "foo",
1987
"SignatureVersion": "1",
1988
"Action": "DescribeInstances"})
1990
"ActionDescribeInstancesAWSAccessKeyIdfooSignatureVersion1")
1991
self.assertEqual(signing_text, signature.old_signing_text())
1993
def test_sorted_params(self):
1994
signature = client.Signature(self.creds, self.endpoint, self.params)
1995
self.params.update({"AWSAccessKeyId": "foo",
1997
"SignatureVersion": "2",
1998
"Version": "2009-11-30",
1999
"Action": "DescribeInstances"})
2002
("AWSAccessKeyId", "foo"),
2003
("Action", "DescribeInstances"),
2004
("SignatureVersion", "2"),
2005
("Version", "2009-11-30"),
2007
], signature.sorted_params())
2010
1467
class QueryPageGetterTestCase(TXAWSTestCase):
2012
1469
def setUp(self):