Beispiel #1
0
    def do_GET(self):
        path = self.path[1:]

        try:
            response = cli.find(path, False)
            self.send_response(200)
            self.send_header("Content-Type", "application/json")
            self.end_headers()
            self.wfile.write(response)
        except PathNotFoundError as e:
            self.send_error(404, "path %s does not exist" % e)
Beispiel #2
0
    def do_GET(self):
        path = self.path[1:]

        try:
            response = cli.find(path, False)
            self.send_response(200)
            self.send_header("Content-Type", "application/json")
            self.end_headers()
            self.wfile.write(response)
        except PathNotFoundError as e:
            self.send_error(404, "path %s does not exist" % e)
Beispiel #3
0
def test_proc_cannotlist(proc):
    with pytest.raises(AttributeError):
        assert cli.find('cpuinfo/0/cpu_family', True)
Beispiel #4
0
def test_proc_badfile(proc):
    with pytest.raises(PathNotFoundError):
        assert cli.find('jbsdabfjasdbfsdafl', False)
Beispiel #5
0
def test_proc_itemorattr(proc):
    assert cli.find('loadavg/average/15', False)
Beispiel #6
0
def test_proc_processes(proc):
    assert cli.find('1', False)
Beispiel #7
0
def test_proc_timedata(proc):
    assert cli.find('1/stat', False)
Beispiel #8
0
def test_proc_cannotlist(proc):
    with pytest.raises(AttributeError):
        assert cli.find('cpuinfo/0/cpu_family', True)
Beispiel #9
0
def test_proc_badfile(proc):
    with pytest.raises(PathNotFoundError):
        assert cli.find('jbsdabfjasdbfsdafl', False)
Beispiel #10
0
def test_proc_itemorattr(proc):
    assert cli.find('loadavg/average/15', False)
Beispiel #11
0
def test_proc_processes(proc):
    assert cli.find('1', False)
Beispiel #12
0
def test_proc_timedata(proc):
    assert cli.find('1/stat', False)