Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Timo Ley
synapse
Commits
06b331ff
Commit
06b331ff
authored
6 years ago
by
Neil Johnson
Browse files
Options
Downloads
Patches
Plain Diff
fix off by 1 errors
parent
8f9a7eb5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/handlers/test_auth.py
+0
-1
0 additions, 1 deletion
tests/handlers/test_auth.py
tests/handlers/test_register.py
+14
-2
14 additions, 2 deletions
tests/handlers/test_register.py
with
14 additions
and
3 deletions
tests/handlers/test_auth.py
+
0
−
1
View file @
06b331ff
...
@@ -177,7 +177,6 @@ class AuthTestCase(unittest.TestCase):
...
@@ -177,7 +177,6 @@ class AuthTestCase(unittest.TestCase):
self
.
_get_macaroon
().
serialize
()
self
.
_get_macaroon
().
serialize
()
)
)
@defer.inlineCallbacks
@defer.inlineCallbacks
def
test_mau_limits_not_exceeded
(
self
):
def
test_mau_limits_not_exceeded
(
self
):
self
.
hs
.
config
.
limit_usage_by_mau
=
True
self
.
hs
.
config
.
limit_usage_by_mau
=
True
...
...
This diff is collapsed.
Click to expand it.
tests/handlers/test_register.py
+
14
−
2
View file @
06b331ff
...
@@ -98,7 +98,7 @@ class RegistrationTestCase(unittest.TestCase):
...
@@ -98,7 +98,7 @@ class RegistrationTestCase(unittest.TestCase):
def
test_get_or_create_user_mau_not_blocked
(
self
):
def
test_get_or_create_user_mau_not_blocked
(
self
):
self
.
hs
.
config
.
limit_usage_by_mau
=
True
self
.
hs
.
config
.
limit_usage_by_mau
=
True
self
.
store
.
count_monthly_users
=
Mock
(
self
.
store
.
count_monthly_users
=
Mock
(
return_value
=
defer
.
succeed
(
self
.
small_number_of_users
)
return_value
=
defer
.
succeed
(
self
.
hs
.
config
.
max_mau_value
-
1
)
)
)
# Ensure does not throw exception
# Ensure does not throw exception
yield
self
.
handler
.
get_or_create_user
(
"
@user:server
"
,
'
c
'
,
"
User
"
)
yield
self
.
handler
.
get_or_create_user
(
"
@user:server
"
,
'
c
'
,
"
User
"
)
...
@@ -112,6 +112,12 @@ class RegistrationTestCase(unittest.TestCase):
...
@@ -112,6 +112,12 @@ class RegistrationTestCase(unittest.TestCase):
with
self
.
assertRaises
(
AuthError
):
with
self
.
assertRaises
(
AuthError
):
yield
self
.
handler
.
get_or_create_user
(
"
requester
"
,
'
b
'
,
"
display_name
"
)
yield
self
.
handler
.
get_or_create_user
(
"
requester
"
,
'
b
'
,
"
display_name
"
)
self
.
store
.
get_monthly_active_count
=
Mock
(
return_value
=
defer
.
succeed
(
self
.
hs
.
config
.
max_mau_value
)
)
with
self
.
assertRaises
(
AuthError
):
yield
self
.
handler
.
get_or_create_user
(
"
requester
"
,
'
b
'
,
"
display_name
"
)
@defer.inlineCallbacks
@defer.inlineCallbacks
def
test_register_mau_blocked
(
self
):
def
test_register_mau_blocked
(
self
):
self
.
hs
.
config
.
limit_usage_by_mau
=
True
self
.
hs
.
config
.
limit_usage_by_mau
=
True
...
@@ -124,7 +130,7 @@ class RegistrationTestCase(unittest.TestCase):
...
@@ -124,7 +130,7 @@ class RegistrationTestCase(unittest.TestCase):
self
.
store
.
get_monthly_active_count
=
Mock
(
self
.
store
.
get_monthly_active_count
=
Mock
(
return_value
=
defer
.
succeed
(
self
.
hs
.
config
.
max_mau_value
)
return_value
=
defer
.
succeed
(
self
.
hs
.
config
.
max_mau_value
)
)
)
with
self
.
assertRaises
(
Registration
Error
):
with
self
.
assertRaises
(
Auth
Error
):
yield
self
.
handler
.
register
(
localpart
=
"
local_part
"
)
yield
self
.
handler
.
register
(
localpart
=
"
local_part
"
)
@defer.inlineCallbacks
@defer.inlineCallbacks
...
@@ -135,3 +141,9 @@ class RegistrationTestCase(unittest.TestCase):
...
@@ -135,3 +141,9 @@ class RegistrationTestCase(unittest.TestCase):
)
)
with
self
.
assertRaises
(
AuthError
):
with
self
.
assertRaises
(
AuthError
):
yield
self
.
handler
.
register_saml2
(
localpart
=
"
local_part
"
)
yield
self
.
handler
.
register_saml2
(
localpart
=
"
local_part
"
)
self
.
store
.
get_monthly_active_count
=
Mock
(
return_value
=
defer
.
succeed
(
self
.
hs
.
config
.
max_mau_value
)
)
with
self
.
assertRaises
(
AuthError
):
yield
self
.
handler
.
register_saml2
(
localpart
=
"
local_part
"
)
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