Exemple #1
0
class Depict(object):

    def __init__(self):
        self.sender = DataSender()
        self.sender.start()

    def run(self, file_path):
        retriever = DataRetriever(self.sender.send_message)
        retriever.run(file_path)

    @contextmanager
    def trace(self, root_dir_path):
        retriever = DataRetriever(self.sender.send_message)
        with retriever.trace(root_dir_path) as tracer:
            yield tracer

    def stop(self):
        self.sender.stop()

    @property
    def http_port(self):
        return self.sender.server.http_port
Exemple #2
0
 def __init__(self):
     self.sender = DataSender()
     self.sender.start()
Exemple #3
0
 def test_it_stops_the_web_server(self, web_server):
     sender = Sender()
     sender.stop()
     web_server.return_value.stop.assert_called_once_with()
Exemple #4
0
 def test_sends_data_to_web_server(self, web_server):
     sender = Sender()
     sender.send_message('hi')
     web_server.return_value.send_message.assert_called_once_with('hi')