Exemplo n.º 1
0
 def test_captures_exceptions(self):
     result = functions.stat_path('/does/not/exist')
     assert result['exception']['attributes']['errno'] == '2'
     assert result['exception']['name'] in ['FileNotFoundError', 'OSError']
Exemplo n.º 2
0
 def test_no_callables(self, tmpdir):
     result = functions.stat_path(str(tmpdir))
     for value in result.values():
         assert callable(value) is False
Exemplo n.º 3
0
 def test_stat_dir(self, tmpdir):
     result = functions.stat_path(str(tmpdir))
     assert result != {}
Exemplo n.º 4
0
    def test_exception_is_empty_on_success(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename)

        result = functions.stat_path(filename)
        assert not result["exception"]
Exemplo n.º 5
0
    def test_includes_file_content(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename, contents="foo")

        result = functions.stat_path(filename, get_contents=True)
        assert result["contents"] == "foo"
Exemplo n.º 6
0
    def test_stat_file_includes_group(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'file')
        make_test_file(filename)

        result = functions.stat_path(filename)
        assert "group" in result