Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
3904917e
Verified
Commit
3904917e
authored
Jan 07, 2018
by
Sébastiaan Versteeg
Browse files
Fix registrations services tests
parent
93b0cdb8
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
3904917e
...
...
@@ -19,7 +19,7 @@ pep8:
-
export PIP_CACHE_DIR="pip-cache"
-
mkdir -p pip-cache
-
git log -1
-
pip install tox coverage
-
pip install tox coverage
freezegun
-
apt-get update
-
apt-get install -y ghostscript
# required for Thabloid's tests
script
:
...
...
website/registrations/tests/test_services.py
View file @
3904917e
...
...
@@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
from
django.core
import
mail
from
django.test
import
TestCase
from
django.utils
import
timezone
from
freezegun
import
freeze_time
from
members.models
import
Member
,
Membership
from
registrations
import
services
...
...
@@ -316,9 +317,7 @@ class ServicesTest(TestCase):
self
.
e2
.
username
=
'ptest'
self
.
e2
.
save
()
now
=
timezone
.
now
()
with
mock
.
patch
(
'django.utils.timezone.now'
)
as
timezone_mock
:
timezone_mock
.
return_value
=
now
.
replace
(
month
=
1
)
with
freeze_time
(
"2017-01-12"
):
lecture_year
=
datetime_to_lectureyear
(
timezone
.
now
())
m1
=
services
.
_create_member_from_registration
(
self
.
e1
)
...
...
@@ -343,17 +342,17 @@ class ServicesTest(TestCase):
membership2
.
delete
()
with
freeze_time
(
"2017-08-12"
):
# Check if since is new lecture year in august
timezone_mock
.
return_value
=
now
.
replace
(
month
=
8
)
membership2
=
services
.
_create_membership_from_entry
(
self
.
e2
,
m2
)
self
.
assertEqual
(
membership2
.
since
,
now
.
date
().
replace
(
self
.
assertEqual
(
membership2
.
since
,
timezone
.
now
()
.
date
().
replace
(
month
=
9
,
day
=
1
))
self
.
assertEqual
(
membership2
.
until
,
None
)
self
.
assertEqual
(
membership2
.
user
,
m2
)
self
.
assertEqual
(
membership2
.
type
,
self
.
e2
.
membership_type
)
timezone_mock
.
return_value
=
now
.
replace
(
month
=
1
)
with
freeze_time
(
"2017-01-12"
):
# Renewal to new 'study' membership starting today
self
.
e3
.
length
=
Entry
.
MEMBERSHIP_STUDY
membership3
=
services
.
_create_membership_from_entry
(
self
.
e3
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment