Best Python code snippet using tempest_python
test_rebuild_server.py
Source:test_rebuild_server.py
...122 json={'networks': []}),123 ])124 self.assertEqual(125 self.rebuild_server['status'],126 self.cloud.rebuild_server(self.fake_server['id'], "a")['status'])127 self.assert_calls()128 def test_rebuild_server_with_admin_pass_no_wait(self):129 """130 Test that a server with an admin_pass passed returns the password131 """132 password = self.getUniqueString('password')133 rebuild_server = self.rebuild_server.copy()134 rebuild_server['adminPass'] = password135 self.register_uris([136 dict(method='POST',137 uri=self.get_mock_url(138 'compute', 'public',139 append=['servers', self.server_id, 'action']),140 json={'server': rebuild_server},141 validate=dict(142 json={143 'rebuild': {144 'imageRef': 'a',145 'adminPass': password}})),146 dict(method='GET',147 uri=self.get_mock_url(148 'network', 'public', append=['v2.0', 'networks.json']),149 json={'networks': []}),150 ])151 self.assertEqual(152 password,153 self.cloud.rebuild_server(154 self.fake_server['id'], 'a',155 admin_pass=password)['adminPass'])156 self.assert_calls()157 def test_rebuild_server_with_admin_pass_wait(self):158 """159 Test that a server with an admin_pass passed returns the password160 """161 password = self.getUniqueString('password')162 rebuild_server = self.rebuild_server.copy()163 rebuild_server['adminPass'] = password164 self.register_uris([165 dict(method='POST',166 uri=self.get_mock_url(167 'compute', 'public',168 append=['servers', self.server_id, 'action']),169 json={'server': rebuild_server},170 validate=dict(171 json={172 'rebuild': {173 'imageRef': 'a',174 'adminPass': password}})),175 dict(method='GET',176 uri=self.get_mock_url(177 'compute', 'public', append=['servers', 'detail']),178 json={'servers': [self.rebuild_server]}),179 dict(method='GET',180 uri=self.get_mock_url(181 'compute', 'public', append=['servers', 'detail']),182 json={'servers': [self.fake_server]}),183 dict(method='GET',184 uri=self.get_mock_url(185 'network', 'public', append=['v2.0', 'networks.json']),186 json={'networks': []}),187 ])188 self.assertEqual(189 password,190 self.cloud.rebuild_server(191 self.fake_server['id'], 'a',192 admin_pass=password, wait=True)['adminPass'])193 self.assert_calls()194 def test_rebuild_server_wait(self):195 """196 Test that rebuild_server with a wait returns the server instance when197 its status changes to "ACTIVE".198 """199 self.register_uris([200 dict(method='POST',201 uri=self.get_mock_url(202 'compute', 'public',203 append=['servers', self.server_id, 'action']),204 json={'server': self.rebuild_server},205 validate=dict(206 json={207 'rebuild': {208 'imageRef': 'a'}})),209 dict(method='GET',210 uri=self.get_mock_url(211 'compute', 'public', append=['servers', 'detail']),212 json={'servers': [self.rebuild_server]}),213 dict(method='GET',214 uri=self.get_mock_url(215 'compute', 'public', append=['servers', 'detail']),216 json={'servers': [self.fake_server]}),217 dict(method='GET',218 uri=self.get_mock_url(219 'network', 'public', append=['v2.0', 'networks.json']),220 json={'networks': []}),221 ])222 self.assertEqual(223 'ACTIVE',224 self.cloud.rebuild_server(225 self.fake_server['id'], 'a', wait=True)['status'])...
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!!