def consume_queue(event, context): config.update_from_file('settings.py') fc = FileCopier() for record in event['Records']: body = json.loads(record['body']) print(body) fc.copy_files(body)
def cli(config_file): """Load the config. When running a local command you should specify a settings file which should contain details of the environment. """ if config_file is not None: config.update_from_file(config_file)
def test_put_to_aws(): config.update_from_file('settings.py') fc = FileCopier() s3_file = "s3://rackspace-image-archive/test.txt" service, file = s3_file.split(":") assert service == "s3" success = fc._put_to_aws(file, "test") assert success
def test_get_from_rackspace(): config.update_from_file('settings.py') fc = FileCopier() cloudfile = "cloudfiles://important_things/test.txt" service, file = cloudfile.split(":") assert service == "cloudfiles" body = fc._get_from_rackspace(file) assert body == b"test"
def test_get_from_aws(): config.update_from_file('settings.py') fc = FileCopier() s3_file = "s3://rackspace-image-archive/test.txt" service, file = s3_file.split(":") assert service == "s3" body = fc._get_from_aws(file) assert body == b"test"