Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
5af2e965
Commit
5af2e965
authored
Oct 18, 2013
by
willmcgugan@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for getinfokeys
parent
32a62c41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
fs/tests/__init__.py
+17
-2
No files found.
fs/tests/__init__.py
View file @
5af2e965
...
@@ -514,8 +514,23 @@ class FSTestCases(object):
...
@@ -514,8 +514,23 @@ class FSTestCases(object):
self
.
assertRaises
(
self
.
assertRaises
(
ResourceNotFoundError
,
self
.
fs
.
getinfo
,
"info.txt/inval"
)
ResourceNotFoundError
,
self
.
fs
.
getinfo
,
"info.txt/inval"
)
def
test_infokeys
(
self
):
test_str
=
b
(
"Hello, World!"
)
self
.
fs
.
setcontents
(
"info.txt"
,
test_str
)
info
=
self
.
fs
.
getinfo
(
"info.txt"
)
for
k
,
v
in
info
.
iteritems
():
self
.
assertEqual
(
self
.
fs
.
getinfokeys
(
'info.txt'
,
k
),
{
k
:
v
})
test_info
=
{}
if
'modified_time'
in
info
:
test_info
[
'modified_time'
]
=
info
[
'modified_time'
]
if
'size'
in
info
:
test_info
[
'size'
]
=
info
[
'size'
]
self
.
assertEqual
(
self
.
fs
.
getinfokeys
(
'info.txt'
,
'size'
,
'modified_time'
),
test_info
)
self
.
assertEqual
(
self
.
fs
.
getinfokeys
(
'info.txt'
,
'thiscantpossiblyexistininfo'
),
{})
def
test_getsize
(
self
):
def
test_getsize
(
self
):
test_str
=
b
(
"*"
)
*
23
test_str
=
b
(
"*"
)
*
23
self
.
fs
.
setcontents
(
"info.txt"
,
test_str
)
self
.
fs
.
setcontents
(
"info.txt"
,
test_str
)
size
=
self
.
fs
.
getsize
(
"info.txt"
)
size
=
self
.
fs
.
getsize
(
"info.txt"
)
self
.
assertEqual
(
size
,
len
(
test_str
))
self
.
assertEqual
(
size
,
len
(
test_str
))
...
@@ -900,7 +915,7 @@ class FSTestCases(object):
...
@@ -900,7 +915,7 @@ class FSTestCases(object):
def
test_zero_read
(
self
):
def
test_zero_read
(
self
):
"""Test read(0) returns empty string"""
"""Test read(0) returns empty string"""
self
.
fs
.
setcontents
(
'foo.txt'
,
b
(
'Hello, World'
)
)
self
.
fs
.
setcontents
(
'foo.txt'
,
b
(
'Hello, World'
))
with
self
.
fs
.
open
(
'foo.txt'
,
'rb'
)
as
f
:
with
self
.
fs
.
open
(
'foo.txt'
,
'rb'
)
as
f
:
self
.
assert_
(
len
(
f
.
read
(
0
))
==
0
)
self
.
assert_
(
len
(
f
.
read
(
0
))
==
0
)
with
self
.
fs
.
open
(
'foo.txt'
,
'rt'
)
as
f
:
with
self
.
fs
.
open
(
'foo.txt'
,
'rt'
)
as
f
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment