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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
20ee9945
Commit
20ee9945
authored
Jul 19, 2013
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
don't rely on admin user but create a test user for Test_Encryption_Keymanager
parent
7fac7fef
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_encryption/tests/keymanager.php
+15
-17
15 additions, 17 deletions
apps/files_encryption/tests/keymanager.php
with
15 additions
and
17 deletions
apps/files_encryption/tests/keymanager.php
+
15
−
17
View file @
20ee9945
...
@@ -14,6 +14,7 @@ require_once realpath(dirname(__FILE__) . '/../lib/stream.php');
...
@@ -14,6 +14,7 @@ require_once realpath(dirname(__FILE__) . '/../lib/stream.php');
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../lib/util.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../lib/util.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../lib/helper.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../lib/helper.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../appinfo/app.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/../appinfo/app.php'
);
require_once
realpath
(
dirname
(
__FILE__
)
.
'/util.php'
);
use
OCA\Encryption
;
use
OCA\Encryption
;
...
@@ -22,6 +23,8 @@ use OCA\Encryption;
...
@@ -22,6 +23,8 @@ use OCA\Encryption;
*/
*/
class
Test_Encryption_Keymanager
extends
\PHPUnit_Framework_TestCase
{
class
Test_Encryption_Keymanager
extends
\PHPUnit_Framework_TestCase
{
const
TEST_USER
=
"test-keymanager-user"
;
public
$userId
;
public
$userId
;
public
$pass
;
public
$pass
;
public
$stateFilesTrashbin
;
public
$stateFilesTrashbin
;
...
@@ -47,17 +50,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
...
@@ -47,17 +50,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
// disable file proxy by default
// disable file proxy by default
\OC_FileProxy
::
$enabled
=
false
;
\OC_FileProxy
::
$enabled
=
false
;
// setup filesystem
// create test user
\OC_Util
::
tearDownFS
();
\OC_User
::
deleteUser
(
\Test_Encryption_Keymanager
::
TEST_USER
);
\OC_User
::
setUserId
(
''
);
\Test_Encryption_Util
::
loginHelper
(
\Test_Encryption_Keymanager
::
TEST_USER
,
true
);
\OC\Files\Filesystem
::
tearDown
();
\OC_Util
::
setupFS
(
'admin'
);
\OC_User
::
setUserId
(
'admin'
);
// login admin
$params
[
'uid'
]
=
'admin'
;
$params
[
'password'
]
=
'admin'
;
OCA\Encryption\Hooks
::
login
(
$params
);
}
}
function
setUp
()
{
function
setUp
()
{
...
@@ -75,9 +70,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
...
@@ -75,9 +70,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
$this
->
view
=
new
\OC_FilesystemView
(
'/'
);
$this
->
view
=
new
\OC_FilesystemView
(
'/'
);
\OC_User
::
setUserId
(
'admin'
);
\OC_User
::
setUserId
(
\Test_Encryption_Keymanager
::
TEST_USER
);
$this
->
userId
=
'admin'
;
$this
->
userId
=
\Test_Encryption_Keymanager
::
TEST_USER
;
$this
->
pass
=
'admin'
;
$this
->
pass
=
\Test_Encryption_Keymanager
::
TEST_USER
;
$userHome
=
\OC_User
::
getHome
(
$this
->
userId
);
$userHome
=
\OC_User
::
getHome
(
$this
->
userId
);
$this
->
dataDir
=
str_replace
(
'/'
.
$this
->
userId
,
''
,
$userHome
);
$this
->
dataDir
=
str_replace
(
'/'
.
$this
->
userId
,
''
,
$userHome
);
...
@@ -101,6 +96,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
...
@@ -101,6 +96,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
public
static
function
tearDownAfterClass
()
{
public
static
function
tearDownAfterClass
()
{
\OC_FileProxy
::
$enabled
=
true
;
\OC_FileProxy
::
$enabled
=
true
;
// cleanup test user
\OC_User
::
deleteUser
(
\Test_Encryption_Keymanager
::
TEST_USER
);
}
}
/**
/**
...
@@ -226,9 +224,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
...
@@ -226,9 +224,9 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
$filename
=
'/tmp-'
.
time
()
.
'.txt'
;
$filename
=
'/tmp-'
.
time
()
.
'.txt'
;
// create folder structure
// create folder structure
$this
->
view
->
mkdir
(
'/
admin
/files/folder1'
);
$this
->
view
->
mkdir
(
'/
'
.
Test_Encryption_Keymanager
::
TEST_USER
.
'
/files/folder1'
);
$this
->
view
->
mkdir
(
'/
admin
/files/folder1/subfolder'
);
$this
->
view
->
mkdir
(
'/
'
.
Test_Encryption_Keymanager
::
TEST_USER
.
'
/files/folder1/subfolder'
);
$this
->
view
->
mkdir
(
'/
admin
/files/folder1/subfolder/subsubfolder'
);
$this
->
view
->
mkdir
(
'/
'
.
Test_Encryption_Keymanager
::
TEST_USER
.
'
/files/folder1/subfolder/subsubfolder'
);
// enable encryption proxy
// enable encryption proxy
$proxyStatus
=
\OC_FileProxy
::
$enabled
;
$proxyStatus
=
\OC_FileProxy
::
$enabled
;
...
...
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