def testAddNoteToServiceGetsMapperDispatchSaveSYNC(self): service = Service("servi") note = ModelObjectNote("a_note") mappersManager = self.createMapperMock() objectMapper = mock() when(mappersManager).getMapper(note.class_signature).thenReturn(objectMapper) when(objectMapper).save(note).thenReturn(True) model_controller = controller.ModelController(mock(), mappersManager) model_controller.addNoteToServiceSYNC(None, service.getID(), note) verify(mappersManager).getMapper(note.class_signature) verify(objectMapper).save(note)
def testAddVulnToServiceGetsMapperDispatchSaveSYNC(self): service = Service("servi") vuln = ModelObjectVuln("a_vuln") mappersManager = self.createMapperMock() objectMapper = mock() when(mappersManager).getMapper(vuln.class_signature).thenReturn(objectMapper) when(objectMapper).save(vuln).thenReturn(True) model_controller = controller.ModelController(mock(), mappersManager) model_controller.addVulnToServiceSYNC(None, service.getID(), vuln) verify(mappersManager).getMapper(vuln.class_signature) verify(objectMapper).save(vuln)