Esempio 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']
Esempio 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
Esempio n. 3
0
 def test_stat_dir(self, tmpdir):
     result = functions.stat_path(str(tmpdir))
     assert result != {}
Esempio 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"]
Esempio 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"
Esempio 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