def test_conflict_public_ip(self): ctx = self.mock_ctx('testconflictip') current_ctx.set(ctx=ctx) ctx.logger.info("BEGIN conflict public_ip test") ctx.logger.info("create public_ip") status_code = public_ip.create(ctx=ctx) ctx.logger.debug("status_code =" + str(status_code) ) self.assertTrue(bool((status_code == 200) or (status_code == 201))) current_ctx.set(ctx=ctx) utils.wait_status(ctx, "public_ip",constants.SUCCEEDED, timeout=600) status_code = public_ip.create(ctx=ctx) ctx.logger.debug("status_code =" + str(status_code) ) self.assertTrue(bool((status_code == 200) or (status_code == 201))) ctx.logger.info("delete public_ip") self.assertEqual(202, public_ip.delete(ctx=ctx)) try: current_ctx.set(ctx=ctx) utils.wait_status(ctx, "public_ip","waiting for exception", timeout=600) except utils.WindowsAzureError: pass ctx.logger.info("delete conflict public_ip") self.assertEqual(204, public_ip.delete(ctx=ctx)) ctx.logger.info("END conflict public_ip test")
def test_delete_public_ip(self): ctx = self.mock_ctx('testdeleteip') current_ctx.set(ctx=ctx) ctx.logger.info("BEGIN public_ip delete test") ctx.logger.info("create public ip with deletable propertie set to False") ctx.node.properties[constants.DELETABLE_KEY] = False status_code = public_ip.create(ctx=ctx) ctx.logger.debug("status_code =" + str(status_code) ) self.assertTrue(bool((status_code == 200) or (status_code == 201))) current_ctx.set(ctx=ctx) utils.wait_status(ctx, "public_ip",constants.SUCCEEDED, timeout=600) ctx.logger.info("not delete public ip") self.assertEqual(0, public_ip.delete(ctx=ctx)) ctx.logger.info("Set deletable propertie to True") ctx.node.properties[constants.DELETABLE_KEY] = True ctx.logger.info("delete public ip") self.assertEqual(202, public_ip.delete(ctx=ctx)) try: current_ctx.set(ctx=ctx) utils.wait_status(ctx, "public_ip","waiting for exception", timeout=600) except utils.WindowsAzureError: pass ctx.logger.info("END public_ip delete test")