예제 #1
0
파일: tests_mock.py 프로젝트: dreko95/Lab2
 def test_bartender(self):
     obj = Bartender(1, 'WORK')
     obj.form_tasks()
     self.assertIsNotNone(len(obj.tasks), "CHECK IT BITCH!!!")
     self.assertIsNotNone(obj.get_task())
예제 #2
0
파일: Server.py 프로젝트: dreko95/Lab2
# We give the signal for the continuation of robots and vydilyaem next subtext to check
@get("/ClientData")
def get_client_data():

    if h.counter >= len(h.tasks):
        h.set_time(time.time() - t)
        print "Calculation is done"
        return {"state": "STOP"}
    h.sent_parts += 1
    return {"state": "WORK", "task": h.get_task(), "full_text": h.full_text}


# We receive data after processing employee
@post("/ClientData")
def post_client_data():

    h.received_parts += 1  #: doccomment for class attribute
    h.clients = h.sent_parts - h.received_parts - 1

    h.percent = int(100 * h.counter / len(h.tasks))
    h.result += int(request.forms.get("result"))


# __main__
if __name__ == "__main__":
    t = time.time()
    h = Bartender("WORK")
    h.form_tasks()
    run(port=8081)  # run