Esempio n. 1
0
def test_creates_symlink(tmp_path):
    args = create_args()
    deployer = deploy.Deployer(args)

    deployer.deploy_standard_dir("vim", install_path=tmp_path)

    assert tmp_path.joinpath(".vim").exists()
Esempio n. 2
0
def test_overwrites_with_force(tmp_path):
    tmp_path.joinpath(".vim").touch()
    args = create_args(force=True)
    deployer = deploy.Deployer(args)

    with mock.patch("deploy.Path.symlink_to") as mock_symlink:
        deployer.deploy_standard_dir("vim", install_path=tmp_path)

    mock_symlink.assert_called_once()
Esempio n. 3
0
 def test_update_working_conf(self):
     create_dirs()
     conf = deploy.Configuration(get_conf())
     dp = deploy.Deployer(conf)
     dp.update_working_conf()
     conf_copy_path = os.path.join(WORKING_DIR, 'conf/config.xml')
     self.assertTrue(os.path.isfile(conf_copy_path))
     with open(conf_copy_path, 'rb') as fr:
         self.assertEqual(KONTEXT_CONF_DATA['config.xml'], fr.read())
Esempio n. 4
0
 def test_create_archive(self):
     create_dirs()
     conf = deploy.Configuration(get_conf())
     dp = deploy.Deployer(conf)
     date_items = (2001, 9, 20, 12, 30, 41)
     arch_path = dp.create_archive(datetime(*date_items))
     exp_arch_path = os.path.join(ARCHIVE_DIR,
                                  '-'.join('%02d' % x for x in date_items))
     self.assertTrue(os.path.isdir(exp_arch_path))
     self.assertEqual(exp_arch_path, arch_path)
Esempio n. 5
0
 def test_remove_current_deployment(self):
     create_dirs()
     os.makedirs(os.path.join(APP_DIR, 'foo/bar'))
     with open(os.path.join(APP_DIR, 'foo/bar/test.txt'), 'wb') as fw:
         fw.write('lorem ipsum dolor sit amet...')
     with open(os.path.join(APP_DIR, 'package.json'), 'wb') as fw:
         fw.write('{}')
     conf = deploy.Configuration(get_conf())
     dp = deploy.Deployer(conf)
     dp.remove_current_deployment()
     self.assertEqual(0, len(os.listdir(APP_DIR)))
Esempio n. 6
0
 def test_copy_app_to_archive(self):
     create_dirs()
     conf = deploy.Configuration(get_conf())
     dp = deploy.Deployer(conf)
     date_items = (2001, 9, 20, 12, 30, 41)
     arch_path = os.path.join(ARCHIVE_DIR,
                              '-'.join('%02d' % x for x in date_items))
     os.makedirs(arch_path)
     dp.copy_app_to_archive(arch_path)
     for item in deploy.FILES:
         self.assertTrue(os.path.exists(os.path.join(arch_path, item)))
Esempio n. 7
0
 def test_copy_configuration(self):
     create_dirs()
     conf = deploy.Configuration(get_conf())
     dp = deploy.Deployer(conf)
     date_items = (2001, 9, 20, 12, 30, 41)
     arch_path = dp.create_archive(datetime(*date_items))
     dp.copy_configuration(arch_path)
     exp_arch_path = os.path.join(ARCHIVE_DIR,
                                  '-'.join('%02d' % x for x in date_items))
     for item in os.listdir(exp_arch_path):
         self.assertTrue(item in deploy.Configuration.KONTEXT_CONF_FILES)
Esempio n. 8
0
from flask import Flask, Blueprint
from flask_cors import CORS
import deploy
from controllers.file_controller import file_controller
from controllers.model_controller import model_controller
from controllers.predict_controller import predict_controller

# app entry point

# call the deploy script
deployer = deploy.Deployer()
# check if the database is up-to-date
# if not, forward the required schema's
# if it is, continue
deployer.forward_schema()

# required variable for registering blueprints
app = Flask(__name__)
CORS(app)
# controller classes
# TODO: make dynamic controller imports and register_blueprint
# app.register_blueprint(file_controller, url_prefix="/file")
app.register_blueprint(model_controller, url_prefix="/model")
app.register_blueprint(predict_controller, url_prefix="/predict")