Beispiel #1
0
    def test_should_be_return_pipeline_status_Passed(self):
        path = os.getcwd()
        response_fine_name = 'instance_pipeline_passed.json'
        response_file = path + '/test/resources/' + response_fine_name

        response = open(response_file, 'r').read()

        pipeline = Pipeline()

        self.assertEquals(pipeline.get_status(response), 'Passed')
Beispiel #2
0
from src.pipeline import Pipeline
from src.arduino_client import Arduino
from src.server import Server

while True:
    protocol = 'http'
    host = 'localhost'
    pipeline = 'piarm'
    gocd = Server(protocol, host, pipeline)
    arduino = Arduino()

    instance_request = requests.get(gocd.history_url)

    pipeline = Pipeline()

    state_request = requests.get(
        gocd.pipeline_url + pipeline.get_instance(instance_request.content))

    pipeline_status = pipeline.get_status(state_request.content)

    print pipeline_status

    if pipeline_status == 'Passed':
        passed = 'b'
        arduino.send(passed)
    else:
        failed = 'a'
        arduino.send(failed)

    time.sleep(5)