'Testing the creation of a vuln to a service'

def test_create_vuln_to_service(self):

    h = self.plugin.createAndAddHost('pepito', 'linux')
    i = self.plugin.createAndAddInterface(h, '1.2.3.4')
    s1 = self.plugin.createAndAddServiceToInterface(h, i, 'unknown', protocol='tcp', ports=['80'])
    s2 = self.plugin.createAndAddServiceToInterface(h, i, 'unknown', protocol='tcp', ports=['443'])
    v = self.plugin.createAndAddVulnToService(h, s1, 'vuln1', 'descripcion')
    self._plugin_controller.last_command_information = self.cmdinfo
    self._plugin_controller.onCommandFinished()
    self._model_controller.processAllPendingActions()
    host = self._model_controller.getHost(h)
    interface = host.getInterface(i)
    service1 = interface.getService(s1)
    service2 = interface.getService(s2)
    self.assertTrue((len(service1.getVulns()) == 1), 'The    service    should    have    one    vuln')
    self.assertTrue((service1.getVuln(v) is not None), "The    vuln    should    be    the    one    we've    just    create")
    self.assertTrue((len(service2.getVulns()) == 0), "The    service    should't    have    any    vuln")
