Esempio n. 1
0
 def test_clone_repo(self):
     builder = Builder(Manifest('info.yaml'))
     builder.clone_repo(
         'https://github.com/antonkurenkov/systembuilder.git')
     # waiting while cloning
     sleep(5)
     assert os.path.isfile('./repo/README.md')
Esempio n. 2
0
 def test_create_dockerfile(self):
     builder = Builder(Manifest('info.yaml'))
     builder.create_dockerfile()
     assert os.path.isfile('Dockerfile')
     with open('Dockerfile', 'r') as dockerfile:
         fst_line = dockerfile.readline()
     assert fst_line == 'FROM python:latest\n'
     os.remove('info.yaml')
     os.remove('Dockerfile')
Esempio n. 3
0
def test_generate_status_file_without_error():
    builder = Builder(Manifest())
    builder.generate_status_file(True)
    assert os.path.isfile('status.json')
    with open('status.json') as status_file:
        status = json.load(status_file)
    assert status['status']
    assert status['message'] == ""
    os.remove('status.json')
Esempio n. 4
0
 def test_generate_status_file_with_error(self):
     builder = Builder(Manifest('info.yaml'))
     project_status = builder.generate_status(False, "error")
     builder.generate_status_file(1.0, {"project": project_status})
     assert os.path.isfile('status.json')
     with open('status.json') as status_file:
         status = json.load(status_file)
     assert not status['status']['project']['status']
     assert status['status']['project']['message'] == 'error'
     os.remove('status.json')
Esempio n. 5
0
 def test_generate_status_file_without_error(self):
     builder = Builder(Manifest('info.yaml'))
     project_status = builder.generate_status(True)
     builder.generate_status_file(1.0, {"project": project_status})
     assert os.path.isfile('status.json')
     with open('status.json') as status_file:
         status = json.load(status_file)
     assert status['status']['project']['status']
     assert status['status']['project']['message'] == ""
     assert status['version'] == 1.0
     os.remove('status.json')
Esempio n. 6
0
def test_create_dockerfile():
    builder = Builder(Manifest())
    data = {'docker': {'dockerfile': 'FROM python:latest\nENTRYPOINT ["python"]', 'parameters': ['some parameter']}}
    with open('info.yaml', 'w') as file:
        yaml.dump(data, file)
    builder.create_dockerfile('info.yaml')
    assert os.path.isfile('DOCKERFILE')
    with open('DOCKERFILE', 'r') as dockerfile:
        fst_line = dockerfile.readline()
    assert fst_line == 'FROM python:latest\n'
    os.remove('info.yaml')
    os.remove('DOCKERFILE')
Esempio n. 7
0
from src.main.builder import Builder
from src.main.manifest import Manifest

builder = Builder(Manifest())

try:
    builder.get_build()
    message = ""
    status = True
except Exception as e:
    message = str(e)
    status = False

builder.generate_status_file(status, message)