Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5988105c
authored
Jul 04, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fixing remaining pep8 errors
parent
29bbf837
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
firewall/tests.py
+5
-1
firewall/views.py
+6
-4
No files found.
firewall/tests.py
View file @
5988105c
from
django.test
import
TestCase
from
django.test
import
TestCase
from
admin
import
HostAdmin
from
admin
import
HostAdmin
class
MockInstance
:
class
MockInstance
:
def
__init__
(
self
,
groups
):
def
__init__
(
self
,
groups
):
self
.
groups
=
MockGroups
(
groups
)
self
.
groups
=
MockGroups
(
groups
)
class
MockGroup
:
class
MockGroup
:
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
name
=
name
class
MockGroups
:
class
MockGroups
:
def
__init__
(
self
,
groups
):
def
__init__
(
self
,
groups
):
self
.
groups
=
groups
self
.
groups
=
groups
...
@@ -16,6 +19,7 @@ class MockGroups:
...
@@ -16,6 +19,7 @@ class MockGroups:
def
all
(
self
):
def
all
(
self
):
return
self
.
groups
return
self
.
groups
class
HostAdminTestCase
(
TestCase
):
class
HostAdminTestCase
(
TestCase
):
def
test_no_groups
(
self
):
def
test_no_groups
(
self
):
instance
=
MockInstance
([])
instance
=
MockInstance
([])
...
@@ -29,6 +33,6 @@ class HostAdminTestCase(TestCase):
...
@@ -29,6 +33,6 @@ class HostAdminTestCase(TestCase):
def
test_multiple_groups
(
self
):
def
test_multiple_groups
(
self
):
instance
=
MockInstance
([
MockGroup
(
"alma"
),
instance
=
MockInstance
([
MockGroup
(
"alma"
),
MockGroup
(
"korte"
),
MockGroup
(
"szilva"
)])
MockGroup
(
"korte"
),
MockGroup
(
"szilva"
)])
l
=
HostAdmin
.
list_groups
(
instance
)
l
=
HostAdmin
.
list_groups
(
instance
)
self
.
assertEqual
(
l
,
"alma, korte, szilva"
)
self
.
assertEqual
(
l
,
"alma, korte, szilva"
)
firewall/views.py
View file @
5988105c
...
@@ -54,10 +54,12 @@ def firewall_api(request):
...
@@ -54,10 +54,12 @@ def firewall_api(request):
translation
.
activate
(
lang
)
translation
.
activate
(
lang
)
msg
=
render_to_string
(
msg
=
render_to_string
(
'mails/notification-ban-now.txt'
,
'mails/notification-ban-now.txt'
,
{
'user'
:
user
,
{
'bl'
:
obj
,
'user'
:
user
,
'instance:'
:
obj
.
host
.
instance_set
.
get
(),
'bl'
:
obj
,
'url'
:
settings
.
CLOUD_URL
})
'instance:'
:
obj
.
host
.
instance_set
.
get
(),
'url'
:
settings
.
CLOUD_URL
})
SendMailTask
.
delay
(
SendMailTask
.
delay
(
to
=
obj
.
host
.
owner
.
email
,
to
=
obj
.
host
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
subject
=
'[IK Cloud]
%
s'
%
...
...
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