@@ -45,11 +45,11 @@ def setUpClass(cls):
45
45
46
46
cls .client = cosmos_client .CosmosClient (cls .host , cls .masterKey , consistency_level = "Session" ,
47
47
connection_policy = cls .connectionPolicy )
48
- cls .created_database = cls .client .create_database (test_config ._test_config .TEST_DATABASE_ID )
48
+ cls .created_database = cls .client .create_database_if_not_exists (test_config ._test_config .TEST_DATABASE_ID )
49
49
50
50
def test_auto_scale (self ):
51
51
created_container = self .created_database .create_container (
52
- id = 'container_with_auto_scale_settings ' ,
52
+ id = 'auto_scale ' ,
53
53
partition_key = PartitionKey (path = "/id" ),
54
54
offer_throughput = ThroughputProperties (auto_scale_max_throughput = 7000 , auto_scale_increment_percent = 0 )
55
55
@@ -74,7 +74,7 @@ def test_auto_scale(self):
74
74
def test_create_container_if_not_exist (self ):
75
75
# Testing auto_scale_settings for the create_container_if_not_exists method
76
76
created_container = self .created_database .create_container_if_not_exists (
77
- id = 'container_with_auto_scale_settings ' ,
77
+ id = 'auto_scale_2 ' ,
78
78
partition_key = PartitionKey (path = "/id" ),
79
79
offer_throughput = ThroughputProperties (auto_scale_max_throughput = 1000 , auto_scale_increment_percent = 3 )
80
80
)
@@ -86,9 +86,11 @@ def test_create_container_if_not_exist(self):
86
86
self .assertEqual (
87
87
created_container_properties .auto_scale_increment_percent , 3 )
88
88
89
+ self .created_database .delete_container (created_container .id )
90
+
89
91
def test_create_database (self ):
90
92
# Testing auto_scale_settings for the create_database method
91
- created_database = self .client .create_database ("db1 " , offer_throughput = ThroughputProperties (
93
+ created_database = self .client .create_database ("db_auto_scale " , offer_throughput = ThroughputProperties (
92
94
auto_scale_max_throughput = 5000 ,
93
95
auto_scale_increment_percent = 0 ))
94
96
created_db_properties = created_database .get_throughput ()
@@ -99,13 +101,14 @@ def test_create_database(self):
99
101
self .assertEqual (
100
102
created_db_properties .auto_scale_increment_percent , 0 )
101
103
102
- self .client .delete_database ("db1 " )
104
+ self .client .delete_database ("db_auto_scale " )
103
105
104
106
def test_create_database_if_not_exists (self ):
105
107
# Testing auto_scale_settings for the create_database_if_not_exists method
106
- created_database = self .client .create_database_if_not_exists ("db2" , offer_throughput = ThroughputProperties (
107
- auto_scale_max_throughput = 9000 ,
108
- auto_scale_increment_percent = 11 ))
108
+ created_database = self .client .create_database_if_not_exists ("db_auto_scale_2" ,
109
+ offer_throughput = ThroughputProperties (
110
+ auto_scale_max_throughput = 9000 ,
111
+ auto_scale_increment_percent = 11 ))
109
112
created_db_properties = created_database .get_throughput ()
110
113
# Testing the input value of the max_throughput
111
114
self .assertNotEqual (
@@ -114,7 +117,7 @@ def test_create_database_if_not_exists(self):
114
117
self .assertEqual (
115
118
created_db_properties .auto_scale_increment_percent , 11 )
116
119
117
- self .client .delete_database ("db2 " )
120
+ self .client .delete_database ("db_auto_scale_2 " )
118
121
119
122
def test_replace_throughput (self ):
120
123
created_container = self .created_database .create_container (
@@ -132,4 +135,4 @@ def test_replace_throughput(self):
132
135
self .assertEqual (
133
136
created_container_properties .auto_scale_increment_percent , 20 )
134
137
135
- self .client . delete_database ( test_config . _test_config . TEST_DATABASE_ID )
138
+ self .created_database . delete_container ( created_container . id )
0 commit comments