Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e9b63096
authored
Oct 28, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
circle: fix tests
parent
668c2659
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
28 deletions
+29
-28
circle/acl/tests/models.py
+1
-26
circle/acl/tests/test_acl.py
+24
-2
circle/dashboard/tests/test_mockedviews.py
+4
-0
No files found.
circle/acl/tests/models.py
View file @
e9b63096
...
@@ -15,29 +15,4 @@
...
@@ -15,29 +15,4 @@
# You should have received a copy of the GNU General Public License along
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
django.db.models
import
TextField
,
ForeignKey
from
.test_acl
import
TestModel
,
Test2Model
# noqa
from
django.contrib.auth.models
import
User
from
..models
import
AclBase
class
TestModel
(
AclBase
):
normal_field
=
TextField
()
ACL_LEVELS
=
(
(
'alfa'
,
'Alfa'
),
(
'bravo'
,
'Bravo'
),
(
'charlie'
,
'Charlie'
),
)
class
Test2Model
(
AclBase
):
normal2_field
=
TextField
()
owner
=
ForeignKey
(
User
,
null
=
True
)
ACL_LEVELS
=
(
(
'one'
,
'One'
),
(
'two'
,
'Two'
),
(
'three'
,
'Three'
),
(
'owner'
,
'owner'
),
)
circle/acl/tests/test_acl.py
View file @
e9b63096
...
@@ -17,9 +17,31 @@
...
@@ -17,9 +17,31 @@
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
,
Group
,
AnonymousUser
from
django.contrib.auth.models
import
User
,
Group
,
AnonymousUser
from
django.db.models
import
TextField
,
ForeignKey
from
..models
import
ObjectLevel
from
..models
import
ObjectLevel
,
AclBase
from
.models
import
TestModel
,
Test2Model
class
TestModel
(
AclBase
):
normal_field
=
TextField
()
ACL_LEVELS
=
(
(
'alfa'
,
'Alfa'
),
(
'bravo'
,
'Bravo'
),
(
'charlie'
,
'Charlie'
),
)
class
Test2Model
(
AclBase
):
normal2_field
=
TextField
()
owner
=
ForeignKey
(
User
,
null
=
True
)
ACL_LEVELS
=
(
(
'one'
,
'One'
),
(
'two'
,
'Two'
),
(
'three'
,
'Three'
),
(
'owner'
,
'owner'
),
)
class
AclUserTest
(
TestCase
):
class
AclUserTest
(
TestCase
):
...
...
circle/dashboard/tests/test_mockedviews.py
View file @
e9b63096
...
@@ -389,6 +389,7 @@ class RenewViewTest(unittest.TestCase):
...
@@ -389,6 +389,7 @@ class RenewViewTest(unittest.TestCase):
inst
=
MagicMock
(
spec
=
Instance
)
inst
=
MagicMock
(
spec
=
Instance
)
inst
.
_meta
.
object_name
=
"Instance"
inst
.
_meta
.
object_name
=
"Instance"
inst
.
name
=
'foo'
inst
.
name
=
'foo'
inst
.
lease
=
MagicMock
(
pk
=
99
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
has_level
.
return_value
=
True
inst
.
has_level
.
return_value
=
True
go
.
return_value
=
inst
go
.
return_value
=
inst
...
@@ -403,6 +404,7 @@ class RenewViewTest(unittest.TestCase):
...
@@ -403,6 +404,7 @@ class RenewViewTest(unittest.TestCase):
patch
(
'dashboard.views.util.messages'
)
as
msg
:
patch
(
'dashboard.views.util.messages'
)
as
msg
:
inst
=
MagicMock
(
spec
=
Instance
)
inst
=
MagicMock
(
spec
=
Instance
)
inst
.
_meta
.
object_name
=
"Instance"
inst
.
_meta
.
object_name
=
"Instance"
inst
.
lease
=
MagicMock
(
pk
=
99
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
.
async
=
MagicMock
()
inst
.
renew
.
async
=
MagicMock
()
inst
.
has_level
.
return_value
=
True
inst
.
has_level
.
return_value
=
True
...
@@ -421,6 +423,7 @@ class RenewViewTest(unittest.TestCase):
...
@@ -421,6 +423,7 @@ class RenewViewTest(unittest.TestCase):
patch
(
'dashboard.views.util.messages'
)
as
msg
:
patch
(
'dashboard.views.util.messages'
)
as
msg
:
inst
=
MagicMock
(
spec
=
Instance
)
inst
=
MagicMock
(
spec
=
Instance
)
inst
.
_meta
.
object_name
=
"Instance"
inst
.
_meta
.
object_name
=
"Instance"
inst
.
lease
=
MagicMock
(
pk
=
99
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
.
async
=
MagicMock
()
inst
.
renew
.
async
=
MagicMock
()
inst
.
has_level
.
return_value
=
True
inst
.
has_level
.
return_value
=
True
...
@@ -463,6 +466,7 @@ class RenewViewTest(unittest.TestCase):
...
@@ -463,6 +466,7 @@ class RenewViewTest(unittest.TestCase):
with
patch
.
object
(
view
,
'get_object'
)
as
go
:
with
patch
.
object
(
view
,
'get_object'
)
as
go
:
inst
=
MagicMock
(
spec
=
Instance
,
pk
=
11
)
inst
=
MagicMock
(
spec
=
Instance
,
pk
=
11
)
inst
.
_meta
.
object_name
=
"Instance"
inst
.
_meta
.
object_name
=
"Instance"
inst
.
lease
=
MagicMock
(
pk
=
99
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
=
Instance
.
_ops
[
'renew'
](
inst
)
inst
.
renew
.
async
=
MagicMock
()
inst
.
renew
.
async
=
MagicMock
()
inst
.
has_level
.
return_value
=
False
inst
.
has_level
.
return_value
=
False
...
...
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