Example #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)
Example #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)
Example #3
0
def test_proc_cannotlist(proc):
    with pytest.raises(AttributeError):
        assert cli.find('cpuinfo/0/cpu_family', True)
Example #4
0
def test_proc_badfile(proc):
    with pytest.raises(PathNotFoundError):
        assert cli.find('jbsdabfjasdbfsdafl', False)
Example #5
0
def test_proc_itemorattr(proc):
    assert cli.find('loadavg/average/15', False)
Example #6
0
def test_proc_processes(proc):
    assert cli.find('1', False)
Example #7
0
def test_proc_timedata(proc):
    assert cli.find('1/stat', False)
Example #8
0
def test_proc_cannotlist(proc):
    with pytest.raises(AttributeError):
        assert cli.find('cpuinfo/0/cpu_family', True)
Example #9
0
def test_proc_badfile(proc):
    with pytest.raises(PathNotFoundError):
        assert cli.find('jbsdabfjasdbfsdafl', False)
Example #10
0
def test_proc_itemorattr(proc):
    assert cli.find('loadavg/average/15', False)
Example #11
0
def test_proc_processes(proc):
    assert cli.find('1', False)
Example #12
0
def test_proc_timedata(proc):
    assert cli.find('1/stat', False)