Best Python code snippet using localstack_python
test_ci_cd.py
Source:test_ci_cd.py
...15 def teardown_class(self):16 integration_id = self.integration_tool.get_integration_id(self.integration_name)17 sonar_integration_id = self.integration_tool.get_integration_id(self.sonar_integration_name)18 # clair_integration_id = self.integration_tool.get_integration_id(self.clair_integration_name)19 self.integration_tool.delete_integration(integration_id)20 self.integration_tool.delete_integration(sonar_integration_id)21 # self.integration_tool.delete_integration(clair_integration_id)22 def test_ci_cd(self):23 # create integration instance24 create_ret = self.integration_tool.create_integration('./test_data/integration/ci_cd/create_integration.json',25 {"$INTEGRATION_NAME": self.integration_name})26 assert create_ret.status_code == 201, "å建éæä¸å¿å®ä¾å¤±è´¥"27 logger.info("å建éæä¸å¿å®ä¾æå")28 integration_id = create_ret.json()['id']29 # get integration instance status30 get_ret = self.integration_tool.get_integration_detail(integration_id)31 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'32 status = get_ret.json()['enabled']33 assert status, "å®ä¾ä¸æ¯å¯ç¨ç¶æ"34 logger.info("éæå®ä¾æ¯å¯ç¨ç¶æ")35 # stop integration instance36 stop = self.integration_tool.stop_integration(integration_id,37 './test_data/integration/ci_cd/stop_integration.json',38 {"$INTEGRATION_NAME": self.integration_name})39 assert stop.status_code == 200, "åç¨å®ä¾æä½å¤±è´¥"40 # get integration instance status41 get_ret = self.integration_tool.get_integration_detail(integration_id)42 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'43 status = get_ret.json()['enabled']44 assert not status, "å®ä¾åç¨å¤±è´¥"45 logger.info("å®ä¾åç¨æå")46 # update integration instance47 update_ret = self.integration_tool.update_integration(integration_id,48 './test_data/integration/ci_cd/update_integration.json',49 {"$INTEGRATION_NAME": self.integration_name,50 "$DESCRIPTION": self.description})51 assert update_ret.status_code == 200, "æ´æ°å®ä¾æä½å¤±è´¥"52 # get integration instance status53 get_ret = self.integration_tool.get_integration_detail(integration_id)54 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'55 description = get_ret.json()['description']56 assert description == self.description, "æ´æ°å®ä¾å¤±è´¥"57 logger.info("æ´æ°å®ä¾æå")58 # delete integration instance59 delete_ret = self.integration_tool.delete_integration(integration_id)60 assert delete_ret.status_code == 204, "å é¤å®ä¾æä½å¤±è´¥"61 get_ret = self.integration_tool.get_integration_detail(integration_id)62 assert get_ret.status_code == 404, "å®ä¾æ²¡æ被æåå é¤æ"63 logger.info("å é¤å®ä¾æå")64 def test_sonar_integration(self):65 # create integration instance66 create_ret = self.integration_tool.create_integration(67 './test_data/integration/sonar/create_sonar_integration.json',68 {"$integration_name": self.sonar_integration_name})69 assert create_ret.status_code == 201, "å建éæä¸å¿å®ä¾å¤±è´¥"70 integration_id = create_ret.json()['id']71 # get integration instance status72 get_ret = self.integration_tool.get_integration_detail(integration_id)73 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'74 status = get_ret.json()['enabled']75 assert status, "å®ä¾ä¸æ¯å¯ç¨ç¶æ"76 # stop integration instance77 stop = self.integration_tool.stop_integration(integration_id,78 './test_data/integration/sonar/stop_sonar_integration.json',79 {"$integration_name": self.sonar_integration_name})80 assert stop.status_code == 200, "åç¨å®ä¾æä½å¤±è´¥"81 # get integration instance status82 get_ret = self.integration_tool.get_integration_detail(integration_id)83 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'84 status = get_ret.json()['enabled']85 assert not status, "å®ä¾åç¨å¤±è´¥"86 # update integration instance87 update_ret = self.integration_tool.update_integration(88 integration_id, './test_data/integration/sonar/update_sonar_integration.json',89 {"$integration_name": self.sonar_integration_name, "$description": self.description})90 assert update_ret.status_code == 200, "æ´æ°å®ä¾æä½å¤±è´¥"91 # get integration instance status92 get_ret = self.integration_tool.get_integration_detail(integration_id)93 assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'94 description = get_ret.json()['description']95 assert description == self.description, "æ´æ°å®ä¾å¤±è´¥"96 # delete integration instance97 delete_ret = self.integration_tool.delete_integration(integration_id)98 assert delete_ret.status_code == 204, "å é¤å®ä¾æä½å¤±è´¥"99 get_ret = self.integration_tool.check_integration_exist(integration_id, 404)100 assert get_ret, "å®ä¾æ²¡æ被æåå é¤æ"101 # 2.0å没æéåæ«æï¼æ以ä¸æµclairäº102 # @pytest.mark.clair_integration103 # def test_clair_integration(self):104 # # create integration instance105 # create_ret = self.integration_tool.create_integration(106 # './test_data/integration/clair/create_clair_integration.yaml',107 # {"$integration_name": self.clair_integration_name})108 #109 # assert create_ret.status_code == 201, "å建éæä¸å¿å®ä¾å¤±è´¥"110 #111 # integration_id = create_ret.json()['id']112 #113 # # get integration instance status114 # get_ret = self.integration_tool.get_integration_detail(integration_id)115 # assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'116 #117 # status = get_ret.json()['enabled']118 #119 # assert status, "å®ä¾ä¸æ¯å¯ç¨ç¶æ"120 #121 # # stop integration instance122 # stop = self.integration_tool.stop_integration(integration_id,123 # './test_data/integration/clair/stop_clair_integration.yaml',124 # {"$integration_id": integration_id,125 # "$integration_name": self.clair_integration_name})126 # assert stop.status_code == 200, "åç¨å®ä¾æä½å¤±è´¥"127 #128 # # get integration instance status129 # get_ret = self.integration_tool.get_integration_detail(integration_id)130 # assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'131 #132 # status = get_ret.json()['enabled']133 #134 # assert not status, "å®ä¾åç¨å¤±è´¥"135 #136 # # update integration instance137 # update_ret = self.integration_tool.update_integration(138 # integration_id, './test_data/integration/sonar/update_sonar_integration.yaml',139 # {"$integration_name": self.clair_integration_name, "$description": self.description})140 #141 # assert update_ret.status_code == 200, "æ´æ°å®ä¾æä½å¤±è´¥"142 #143 # # get integration instance status144 # get_ret = self.integration_tool.get_integration_detail(integration_id)145 # assert get_ret.status_code == 200, 'è·åéæä¸å¿ç¶æ失败'146 #147 # description = get_ret.json()['description']148 # assert description == self.description, "æ´æ°å®ä¾å¤±è´¥"149 #150 # # delete integration instance151 # delete_ret = self.integration_tool.delete_integration(integration_id)152 # assert delete_ret.status_code == 204, "å é¤å®ä¾æä½å¤±è´¥"153 #154 # get_ret = self.integration_tool.check_integration_exist(integration_id, 404)...
urls.py
Source:urls.py
1"""2Different URL addresses required3"""4from django.conf.urls import url5#from django.urls import path6from django.urls import path7from django.contrib import admin8from .views import index, userdetails, delete_integration, view_integration9from ..yellowant_api import views10admin.autodiscover()11app_name = 'web'12urlpatterns = [13 path("user/", userdetails, name="home"),14 path("", index, name="index"),15 path("user/<int:id>", delete_integration, name="home"),16 path("accounts/<int:id>/", view_integration, name="home"),17 url(r'^(?P<path>.*)$', index, name="home"),...
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!!