def test_import_lambda(self): try: func = emulambda.import_lambda('testmodule.foo') assert func except BaseException as e: self.fail("Unable to import module and find function.\n%s" % e.message)
def test_Uploadevent(self): """Testing the event""" # creating an emulambda function func = emulambda.import_lambda('cleanuplambda.lambda_handler') # creating an emulambda event event = emulambda.parse_event( open('../ndlambda/functions/cleanup/cleanup_event.json').read()) # calling the emulambda function to invoke a lambda emulambda.invoke_lambda(func, event, None, 0, None) # test if there are any tiles leftover in tile bucket for z_index in range(self.z_tile, settings.SUPER_CUBOID_SIZE[2], 1): tile = self.tile_bucket.getObject(nd_proj.channel_name, nd_proj.resolution, self.x_tile, self.y_tile, z_index) assert (tile is None) # check if there are any entires left in the tileindex table supercuboid_key = self.tileindex_db.generatePrimaryKey( nd_proj.channel_name, nd_proj.resolution, self.x_tile, self.y_tile, self.z_tile) item = self.tileindex_db.getItem(supercuboid_key) assert (item is None) # testing if the message was deleted from the cleanup queue or not for message in self.cleanup_queue.receiveMessage(): # KL TODO write the message id into the JSON event file directly print message
def test_Uploadevent(self): """Testing the event""" # creating an emulambda function func = emulambda.import_lambda("ingestlambda.lambda_handler") # creating an emulambda event event = emulambda.parse_event( open("../ndlambda/functions/ingest/ingest_event.json").read()) # calling the emulambda function to invoke a lambda emulambda.invoke_lambda(func, event, None, 0, None) # testing if the supercuboid was inserted in the bucket morton_index = XYZMorton(self.tiles) cuboid = self.cuboid_bucket.getObject(nd_proj.channel_name, nd_proj.resolution, morton_index) # testing if the message was removed from the ingest queue for message in self.ingest_queue.receiveMessage(): # KL TODO write the message id into the JSON event file directly print(message)
def test_Uploadevent(self): """Testing the event""" # creating an emulambda function func = emulambda.import_lambda("uploadlambda.lambda_handler") # creating an emulambda event event = emulambda.parse_event( open("../ndlambda/functions/upload/upload_event.json").read()) # calling the emulambda function to invoke a lambda emulambda.invoke_lambda(func, event, None, 0, None) # testing if the index was updated in tileindexdb supercuboid_key = self.tileindex_db.generatePrimaryKey( nd_proj.channel_name, nd_proj.resolution, self.x_tile, self.y_tile, self.z_tile, ) item = self.tileindex_db.getItem(supercuboid_key) assert item["zindex_list"] == set([0]) # testing if the message was deleted from the upload queue or not for message in self.upload_queue.receiveMessage(): assert False
def test_import_lambda_missing(self): try: emulambda.import_lambda('testmodule.bar') self.fail("Didn't detect invalid function.") except: assert True
def test_import_lambda_file(self): try: emulambda.import_lambda('/foo/bar') self.fail("Somehow, we imported a file.") except: assert True
def test_import_lambda(self): try: func = emulambda.import_lambda("testmodule.foo") assert func except BaseException as e: self.fail("Unable to import module and find function.\n%s" % e.message)
def test_import_lambda_missing(self): try: emulambda.import_lambda("testmodule.bar") self.fail("Didn't detect invalid function.") except: assert True
def test_import_lambda_file(self): try: emulambda.import_lambda("/foo/bar") self.fail("Somehow, we imported a file.") except: assert True
def test_import_lambda_wrong_file(self): try: emulambda.import_lambda('testmodule/foo.bar.biz') self.fail("Somehow, we imported a file.") except: assert True