Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
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
967abc7b
authored
Feb 19, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assertItemsEqual deprecated
parent
2d0edccd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
circle/acl/tests/test_acl.py
+8
-8
circle/firewall/fields.py
+3
-3
requirements/base.txt
+1
-0
No files found.
circle/acl/tests/test_acl.py
View file @
967abc7b
...
@@ -195,9 +195,9 @@ class AclUserTest(TestCase):
...
@@ -195,9 +195,9 @@ class AclUserTest(TestCase):
i1
.
set_level
(
self
.
u1
,
'alfa'
)
i1
.
set_level
(
self
.
u1
,
'alfa'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
i2
.
set_level
(
self
.
u2
,
'bravo'
)
i2
.
set_level
(
self
.
u2
,
'bravo'
)
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u2
),
[
i2
])
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u2
),
[
i2
])
def
test_get_objects_with_level_for_superuser
(
self
):
def
test_get_objects_with_level_for_superuser
(
self
):
...
@@ -206,11 +206,11 @@ class AclUserTest(TestCase):
...
@@ -206,11 +206,11 @@ class AclUserTest(TestCase):
i1
.
set_level
(
self
.
u1
,
'alfa'
)
i1
.
set_level
(
self
.
u1
,
'alfa'
)
i2
.
set_level
(
self
.
us
,
'alfa'
)
i2
.
set_level
(
self
.
us
,
'alfa'
)
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
])
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
])
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
us
),
[
i1
,
i2
])
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
us
),
[
i1
,
i2
])
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
us
,
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
us
,
disregard_superuser
=
True
),
[
i2
])
disregard_superuser
=
True
),
[
i2
])
...
@@ -220,7 +220,7 @@ class AclUserTest(TestCase):
...
@@ -220,7 +220,7 @@ class AclUserTest(TestCase):
i1
.
set_level
(
self
.
g1
,
'alfa'
)
i1
.
set_level
(
self
.
g1
,
'alfa'
)
i2
.
set_level
(
self
.
g1
,
'bravo'
)
i2
.
set_level
(
self
.
g1
,
'bravo'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
def
test_get_objects_with_group_level
(
self
):
def
test_get_objects_with_group_level
(
self
):
...
@@ -229,9 +229,9 @@ class AclUserTest(TestCase):
...
@@ -229,9 +229,9 @@ class AclUserTest(TestCase):
i1
.
set_level
(
self
.
g1
,
'alfa'
)
i1
.
set_level
(
self
.
g1
,
'alfa'
)
i2
.
set_level
(
self
.
g1
,
'bravo'
)
i2
.
set_level
(
self
.
g1
,
'bravo'
)
i2
.
set_level
(
self
.
g2
,
'bravo'
)
i2
.
set_level
(
self
.
g2
,
'bravo'
)
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_group_level
(
'alfa'
,
self
.
g1
),
[
i1
,
i2
])
TestModel
.
get_objects_with_group_level
(
'alfa'
,
self
.
g1
),
[
i1
,
i2
])
self
.
assert
Items
Equal
(
self
.
assert
Count
Equal
(
TestModel
.
get_objects_with_group_level
(
'alfa'
,
self
.
g2
),
[
i2
])
TestModel
.
get_objects_with_group_level
(
'alfa'
,
self
.
g2
),
[
i2
])
def
test_owner
(
self
):
def
test_owner
(
self
):
...
...
circle/firewall/fields.py
View file @
967abc7b
...
@@ -286,19 +286,19 @@ def val_ipv6_template(value):
...
@@ -286,19 +286,19 @@ def val_ipv6_template(value):
>>> val_ipv6_template("::
%(a)
x:
%(c)
d:
%(d)
d")
>>> val_ipv6_template("::
%(a)
x:
%(c)
d:
%(d)
d")
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ValidationError: [u
"template doesn't use parameter b"]
django.core.exceptions.ValidationError: [
"template doesn't use parameter b"]
Detects valid templates building invalid ips:
Detects valid templates building invalid ips:
>>> val_ipv6_template("xxx::
%(a)
d:
%(b)
d:
%(c)
d:
%(d)
d")
>>> val_ipv6_template("xxx::
%(a)
d:
%(b)
d:
%(c)
d:
%(d)
d")
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ValidationError: [u
'template renders invalid IPv6 address']
django.core.exceptions.ValidationError: [
'template renders invalid IPv6 address']
Also IPv4-compatible addresses are invalid:
Also IPv4-compatible addresses are invalid:
>>> val_ipv6_template("::
%(a)02
x
%(b)02
x:
%(c)
d:
%(d)
d")
>>> val_ipv6_template("::
%(a)02
x
%(b)02
x:
%(c)
d:
%(d)
d")
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ValidationError: [u
'template results in IPv4 address']
django.core.exceptions.ValidationError: [
'template results in IPv4 address']
"""
"""
tpl
=
{
ascii_letters
[
i
]:
255
for
i
in
range
(
4
)}
tpl
=
{
ascii_letters
[
i
]:
255
for
i
in
range
(
4
)}
try
:
try
:
...
...
requirements/base.txt
View file @
967abc7b
...
@@ -53,3 +53,4 @@ enum34==1.1.10
...
@@ -53,3 +53,4 @@ enum34==1.1.10
ipaddress==1.0.23
ipaddress==1.0.23
django-nose==1.4.7
django-nose==1.4.7
nose-exclude==0.5.0
nose-exclude==0.5.0
factory_boy==3.2.1
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