<s> import datetime <EOL> import dateutil . parser <EOL> import mox <EOL> import time <EOL> import unittest <EOL> from aliyun . ecs import connection as ecs <EOL> class RegionTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> region1 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> region2 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( region1 , region2 ) <EOL> def testIDNotEqual ( self ) : <EOL> region1 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> region2 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( region1 , region2 ) <EOL> def testNameNotEqual ( self ) : <EOL> region1 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> region2 = ecs . Region ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( region1 , region2 ) <EOL> def testRepr ( self ) : <EOL> region = ecs . Region ( '<STR_LIT>' , '<STR_LIT:name>' ) <EOL> self . assertTrue ( repr ( region ) . startswith ( u'<STR_LIT>' ) ) <EOL> class InstanceTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . now = datetime . datetime . now ( ) <EOL> self . instance1 = ecs . Instance ( <EOL> '<STR_LIT:id>' , <EOL> '<STR_LIT:name>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:status>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , self . now , self . now , '<STR_LIT:p>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , [ ] , '<STR_LIT:z>' ) <EOL> def testEqual ( self ) : <EOL> instance2 = ecs . Instance ( <EOL> '<STR_LIT:id>' , <EOL> '<STR_LIT:name>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:status>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , self . now , self . now , '<STR_LIT:p>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , [ ] , '<STR_LIT:z>' ) <EOL> self . assertEqual ( self . instance1 , instance2 ) <EOL> def testNotEqual ( self ) : <EOL> instance2 = ecs . Instance ( <EOL> '<STR_LIT:id>' , <EOL> '<STR_LIT:name>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:status>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , self . now , self . now , '<STR_LIT:p>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , [ ] , '<STR_LIT:z>' ) <EOL> self . assertNotEqual ( self . instance1 , instance2 ) <EOL> def testRepr ( self ) : <EOL> self . assertTrue ( repr ( self . instance1 ) . startswith ( '<STR_LIT>' ) ) <EOL> class InstanceStatusTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> is1 = ecs . InstanceStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> is2 = ecs . InstanceStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( is1 , is2 ) <EOL> def testNotEqual ( self ) : <EOL> is1 = ecs . InstanceStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> is2 = ecs . InstanceStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( is1 , is2 ) <EOL> def testRepr ( self ) : <EOL> is1 = ecs . InstanceStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( is1 ) . startswith ( u'<STR_LIT>' ) ) <EOL> class InstanceTypeTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> t1 = ecs . InstanceType ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> t2 = ecs . InstanceType ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> self . assertEqual ( t1 , t2 ) <EOL> def testNotEqual ( self ) : <EOL> t1 = ecs . InstanceType ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> t2 = ecs . InstanceType ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:3> ) <EOL> self . assertNotEqual ( t1 , t2 ) <EOL> def testRepr ( self ) : <EOL> t1 = ecs . InstanceType ( '<STR_LIT>' , <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> self . assertTrue ( repr ( t1 ) . startswith ( u'<STR_LIT>' ) ) <EOL> class SnapshotTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . now = datetime . datetime . now ( ) <EOL> def testEqual ( self ) : <EOL> s1 = ecs . Snapshot ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> , self . now ) <EOL> s2 = ecs . Snapshot ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> , self . now ) <EOL> self . assertEqual ( s1 , s2 ) <EOL> def testNotEqual ( self ) : <EOL> s1 = ecs . Snapshot ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> , self . now ) <EOL> s2 = ecs . Snapshot ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> , self . now ) <EOL> self . assertNotEqual ( s1 , s2 ) <EOL> def testRepr ( self ) : <EOL> s1 = ecs . Snapshot ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> , self . now ) <EOL> self . assertTrue ( repr ( s1 ) . startswith ( u'<STR_LIT>' ) ) <EOL> class AutoSnapshotPolicyTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> asp1 = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> asp2 = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> self . assertEqual ( asp1 , asp2 ) <EOL> def testNotEqual ( self ) : <EOL> asp1 = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> asp2 = ecs . AutoSnapshotPolicy ( True , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> self . assertNotEqual ( asp1 , asp2 ) <EOL> def testRepr ( self ) : <EOL> asp = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> self . assertTrue ( repr ( asp ) . startswith ( u'<STR_LIT>' ) ) <EOL> class AutoSnapshotExecutionStatusTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> ases1 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ases2 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( ases1 , ases2 ) <EOL> def testNotEqual ( self ) : <EOL> ases1 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ases2 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( ases1 , ases2 ) <EOL> def testRepr ( self ) : <EOL> ases = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( ases ) . startswith ( '<STR_LIT>' ) ) <EOL> class AutoSnapshotPolicyStatusTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . policy = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> self . status = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def testEqual ( self ) : <EOL> asps1 = ecs . AutoSnapshotPolicyStatus ( self . status , self . policy ) <EOL> status2 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> policy2 = ecs . AutoSnapshotPolicy ( False , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> asps2 = ecs . AutoSnapshotPolicyStatus ( status2 , policy2 ) <EOL> self . assertEqual ( asps1 , asps2 ) <EOL> def testNotEqual ( self ) : <EOL> asps1 = ecs . AutoSnapshotPolicyStatus ( self . status , self . policy ) <EOL> status2 = ecs . AutoSnapshotExecutionStatus ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> policy2 = ecs . AutoSnapshotPolicy ( True , <NUM_LIT:1> , <NUM_LIT:1> , False , False , <NUM_LIT:1> , <NUM_LIT:1> , False ) <EOL> asps2 = ecs . AutoSnapshotPolicyStatus ( status2 , policy2 ) <EOL> self . assertNotEqual ( asps1 , asps2 ) <EOL> def testRepr ( self ) : <EOL> asps1 = ecs . AutoSnapshotPolicyStatus ( self . status , self . policy ) <EOL> self . assertTrue ( repr ( asps1 ) . startswith ( '<STR_LIT>' ) ) <EOL> class DiskTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> d1 = ecs . Disk ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:5> ) <EOL> d2 = ecs . Disk ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:5> ) <EOL> self . assertEqual ( d1 , d2 ) <EOL> def testNotEqual ( self ) : <EOL> d1 = ecs . Disk ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:5> ) <EOL> d2 = ecs . Disk ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:6> ) <EOL> self . assertNotEqual ( d1 , d2 ) <EOL> def testRepr ( self ) : <EOL> d1 = ecs . Disk ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:5> ) <EOL> self . assertTrue ( <EOL> repr ( d1 ) . startswith ( u'<STR_LIT>' ) ) <EOL> class DiskMappingTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> dm1 = ecs . DiskMapping ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> dm2 = ecs . DiskMapping ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . assertEqual ( dm1 , dm2 ) <EOL> def testNotEqual ( self ) : <EOL> dm1 = ecs . DiskMapping ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> dm2 = ecs . DiskMapping ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . assertNotEqual ( dm1 , dm2 ) <EOL> def testRepr ( self ) : <EOL> dm = ecs . DiskMapping ( '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( dm ) . startswith ( '<STR_LIT>' ) ) <EOL> class ImageTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> i1 = ecs . Image ( '<STR_LIT>' , '<STR_LIT:version>' , '<STR_LIT:name>' , '<STR_LIT>' , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> i2 = ecs . Image ( '<STR_LIT>' , '<STR_LIT:version>' , '<STR_LIT:name>' , '<STR_LIT>' , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( i1 , i2 ) <EOL> def testNotEqual ( self ) : <EOL> i1 = ecs . Image ( '<STR_LIT>' , '<STR_LIT:version>' , '<STR_LIT:name>' , '<STR_LIT>' , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> i2 = ecs . Image ( '<STR_LIT>' , '<STR_LIT:version>' , '<STR_LIT:name>' , '<STR_LIT>' , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( i1 , i2 ) <EOL> def testRepr ( self ) : <EOL> i1 = ecs . Image ( '<STR_LIT>' , '<STR_LIT:version>' , '<STR_LIT:name>' , '<STR_LIT>' , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( i1 ) . startswith ( <EOL> u'<STR_LIT>' ) ) <EOL> class SecurityGroupInfoTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> sg1 = ecs . SecurityGroupInfo ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> sg2 = ecs . SecurityGroupInfo ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( sg1 , sg2 ) <EOL> def testNotEqual ( self ) : <EOL> sg1 = ecs . SecurityGroupInfo ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> sg2 = ecs . SecurityGroupInfo ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( sg1 , sg2 ) <EOL> def testRepr ( self ) : <EOL> sg1 = ecs . SecurityGroupInfo ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( sg1 ) . startswith ( u'<STR_LIT>' ) ) <EOL> class SecurityGroupPermission ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> p2 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( p1 , p2 ) <EOL> def testNotEqual ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> p2 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( p1 , p2 ) <EOL> def testRepr ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( repr ( p1 ) . startswith ( <EOL> u'<STR_LIT>' ) ) <EOL> class SecurityGroupTest ( unittest . TestCase ) : <EOL> def testEqual ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> p2 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> sg1 = ecs . SecurityGroup ( '<STR_LIT:r>' , '<STR_LIT>' , '<STR_LIT:d>' , [ p1 ] ) <EOL> sg2 = ecs . SecurityGroup ( '<STR_LIT:r>' , '<STR_LIT>' , '<STR_LIT:d>' , [ p2 ] ) <EOL> self . assertEqual ( sg1 , sg2 ) <EOL> def testNotEqual ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> p2 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> sg1 = ecs . SecurityGroup ( '<STR_LIT:r>' , '<STR_LIT>' , '<STR_LIT:d>' , [ p1 ] ) <EOL> sg2 = ecs . SecurityGroup ( '<STR_LIT:r>' , '<STR_LIT>' , '<STR_LIT:d>' , [ p2 ] ) <EOL> self . assertNotEqual ( sg1 , sg2 ) <EOL> def testRepr ( self ) : <EOL> p1 = ecs . SecurityGroupPermission ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> sg1 = ecs . SecurityGroup ( '<STR_LIT:r>' , '<STR_LIT>' , '<STR_LIT:d>' , [ p1 ] ) <EOL> self . assertTrue ( repr ( sg1 ) . startswith ( <EOL> u'<STR_LIT>' ) ) <EOL> class ZoneTest ( unittest . TestCase ) : <EOL> def testEqualSimple ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> z2 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( z1 , z2 ) <EOL> def testEqualFull ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> z2 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( z1 , z2 ) <EOL> def testNotEqual ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> z2 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertNotEqual ( z1 , z2 ) <EOL> def testNotEqualDeep ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> z2 = ecs . Zone ( '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertNotEqual ( z1 , z2 ) <EOL> def testRepr ( self ) : <EOL> z = ecs . Zone ( '<STR_LIT:id>' , '<STR_LIT:name>' ) <EOL> self . assertTrue ( repr ( z ) . startswith ( '<STR_LIT>' ) ) <EOL> def testDiskSupported ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT:id>' , '<STR_LIT:name>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( z1 . disk_supported ( '<STR_LIT>' ) ) <EOL> def testResourceCreationSupported ( self ) : <EOL> z1 = ecs . Zone ( '<STR_LIT:id>' , '<STR_LIT:name>' , [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( z1 . resource_creation_supported ( '<STR_LIT>' ) ) </s>
