Best Python code snippet using autotest_python
test_modify_host.py
Source:test_modify_host.py
...16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.18from gvm.errors import RequiredArgument19class GmpModifyHostTestMixin:20 def test_modify_host(self):21 self.gmp.modify_host(host_id="a1")22 self.connection.send.has_been_called_with(23 '<modify_asset asset_id="a1">'24 "<comment></comment>"25 "</modify_asset>"26 )27 def test_modify_host_without_host_id(self):28 with self.assertRaises(RequiredArgument):29 self.gmp.modify_host(host_id=None, comment="foo")30 with self.assertRaises(RequiredArgument):31 self.gmp.modify_host(host_id="", comment="foo")32 with self.assertRaises(RequiredArgument):33 self.gmp.modify_host("", comment="foo")34 def test_modify_host_with_comment(self):35 self.gmp.modify_host("a1", comment="foo")36 self.connection.send.has_been_called_with(37 '<modify_asset asset_id="a1">'38 "<comment>foo</comment>"39 "</modify_asset>"40 )41 self.gmp.modify_host("a1", comment="foo")42 self.connection.send.has_been_called_with(43 '<modify_asset asset_id="a1">'44 "<comment>foo</comment>"45 "</modify_asset>"46 )47 self.gmp.modify_host("a1", comment="")48 self.connection.send.has_been_called_with(49 '<modify_asset asset_id="a1">'50 "<comment></comment>"51 "</modify_asset>"52 )53 self.gmp.modify_host("a1", comment=None)54 self.connection.send.has_been_called_with(55 '<modify_asset asset_id="a1">'56 "<comment></comment>"57 "</modify_asset>"...
urls.py
Source:urls.py
1"""saltshaker URL Configuration2The `urlpatterns` list routes URLs to views. For more information please see:3 https://docs.djangoproject.com/en/1.8/topics/http/urls/4Examples:5Function views6 1. Add an import: from my_app import views7 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')8Class-based views9 1. Add an import: from other_app.views import Home10 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')11Including another URLconf12 1. Add an import: from blog import urls as blog_urls13 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))14"""15from django.conf.urls import include, url16from . import views17urlpatterns = [18 url(r'^manage_group', views.manage_group,name='manage_group'),19 url(r'^del_group', views.del_group,name='del_group'),20 url(r'^add_group', views.add_group,name='add_group'),21 url(r'^modify_group', views.modify_group,name='modify_group'),22 url(r'^manage_host', views.manage_host,name='manage_host'),23 url(r'^modify_host', views.modify_host,name='modify_host'),24 url(r'^add_host', views.add_host,name='add_host'),25 url(r'^del_host', views.del_host,name='del_host'),...
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!!