Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
0f2600e9
Commit
0f2600e9
authored
12 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
add binary test case for encryption
parent
e3f15073
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_encryption/tests/binary
+0
-0
0 additions, 0 deletions
apps/files_encryption/tests/binary
apps/files_encryption/tests/proxy.php
+36
-4
36 additions, 4 deletions
apps/files_encryption/tests/proxy.php
with
36 additions
and
4 deletions
apps/files_encryption/tests/binary
0 → 100644
+
0
−
0
View file @
0f2600e9
File added
This diff is collapsed.
Click to expand it.
apps/files_encryption/tests/proxy.php
+
36
−
4
View file @
0f2600e9
...
...
@@ -7,8 +7,13 @@
*/
class
Test_CryptProxy
extends
UnitTestCase
{
private
$oldConfig
;
public
function
setUp
(){
$this
->
oldConfig
=
OCP\Config
::
getAppValue
(
'files_encryption'
,
'enable_encryption'
,
'true'
);
OCP\Config
::
setAppValue
(
'files_encryption'
,
'enable_encryption'
,
'true'
);
//set testing key
$_SESSION
[
'enckey'
]
=
md5
(
time
());
...
...
@@ -29,10 +34,11 @@ class Test_CryptProxy extends UnitTestCase {
$rootView
->
mkdir
(
'/'
.
OC_User
::
getUser
()
.
'/files'
);
}
public
function
te
stSimple
(){
$oldConfig
=
OCP\Config
::
g
etAppValue
(
'files_encryption'
,
'enable_encryption'
,
'true'
);
OCP\Config
::
setAppValue
(
'files_encryption'
,
'enable_encryption'
,
'true'
);
public
function
te
arDown
(){
OCP\Config
::
s
etAppValue
(
'files_encryption'
,
'enable_encryption'
,
$this
->
oldConfig
);
}
public
function
testSimple
(){
$file
=
OC
::
$SERVERROOT
.
'/3rdparty/MDB2.php'
;
$original
=
file_get_contents
(
$file
);
...
...
@@ -46,16 +52,42 @@ class Test_CryptProxy extends UnitTestCase {
$this
->
assertNotEqual
(
$original
,
$stored
);
$this
->
assertEqual
(
$original
,
$fromFile
);
}
public
function
testView
(){
$file
=
OC
::
$SERVERROOT
.
'/3rdparty/MDB2.php'
;
$original
=
file_get_contents
(
$file
);
$rootView
=
new
OC_FilesystemView
(
''
);
$view
=
new
OC_FilesystemView
(
'/'
.
OC_User
::
getUser
());
$userDir
=
'/'
.
OC_User
::
getUser
()
.
'/files'
;
$rootView
->
file_put_contents
(
$userDir
.
'/file'
,
$original
);
OC_FileProxy
::
$enabled
=
false
;
$stored
=
$rootView
->
file_get_contents
(
$userDir
.
'/file'
);
OC_FileProxy
::
$enabled
=
true
;
$this
->
assertNotEqual
(
$original
,
$stored
);
$fromFile
=
$rootView
->
file_get_contents
(
$userDir
.
'/file'
);
$this
->
assertEqual
(
$original
,
$fromFile
);
$fromFile
=
$view
->
file_get_contents
(
'files/file'
);
$this
->
assertEqual
(
$original
,
$fromFile
);
}
public
function
testBinary
(){
$file
=
__DIR__
.
'/binary'
;
$original
=
file_get_contents
(
$file
);
OC_Filesystem
::
file_put_contents
(
'/file'
,
$original
);
OCP\Config
::
setAppValue
(
'files_encryption'
,
'enable_encryption'
,
$oldConfig
);
OC_FileProxy
::
$enabled
=
false
;
$stored
=
OC_Filesystem
::
file_get_contents
(
'/file'
);
OC_FileProxy
::
$enabled
=
true
;
$fromFile
=
OC_Filesystem
::
file_get_contents
(
'/file'
);
$this
->
assertNotEqual
(
$original
,
$stored
);
$this
->
assertEqual
(
$original
,
$fromFile
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment