Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2021
Kelas D
PT Gizi Sehat - Dietela
Dietela Backend
Commits
21d8da7b
Commit
21d8da7b
authored
Jun 01, 2021
by
Ami
Browse files
adding id on customuser's string representation + changing tests to follow suit
parent
d1d1d3ab
Pipeline
#80636
passed with stages
in 13 minutes
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
authentication/admin.py
View file @
21d8da7b
...
...
@@ -7,7 +7,7 @@ class UserAdmin(BaseUserAdmin):
# The fields to be used in displaying the User model.
# These override the definitions on the base UserAdmin
# that reference specific fields on auth.User.
list_display
=
(
'email'
,)
list_display
=
(
'email'
,
'id'
)
fieldsets
=
(
(
None
,
{
'fields'
:
(
\
'name'
,
...
...
authentication/models.py
View file @
21d8da7b
...
...
@@ -35,4 +35,4 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
objects
=
CustomUserManager
()
def
__str__
(
self
):
return
str
(
self
.
email
)
return
f
"
{
self
.
email
}
+
{
self
.
id
}
"
authentication/tests.py
View file @
21d8da7b
...
...
@@ -105,7 +105,7 @@ class UserModelTests(APITestCase):
def
test_create_user
(
self
):
user
=
CustomUser
.
objects
.
create_user
(
name
=
'tes'
,
email
=
'email2@email.com'
,
password
=
'tes'
,
diet_profile
=
self
.
diet_profile_1
,)
self
.
assertEqual
(
str
(
user
),
'email2@email.com
'
)
self
.
assertEqual
(
str
(
user
),
'email2@email.com
+ '
+
str
(
user
.
id
)
)
self
.
assertEqual
(
user
.
email
,
'email2@email.com'
)
self
.
assertTrue
(
user
.
groups
.
filter
(
name
=
'client'
).
exists
())
self
.
assertTrue
(
user
.
is_active
)
...
...
diet_progress/tests.py
View file @
21d8da7b
...
...
@@ -235,7 +235,7 @@ class WeeklyReportTest(APITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_weekly_report_string
(
self
):
self
.
assertEqual
(
str
(
self
.
weekly_report_1
),
'email2@email.com - Test, S.Gz - Week 1'
)
self
.
assertEqual
(
str
(
self
.
weekly_report_1
),
f
'email2@email.com
+
{
self
.
custom_user_2
.
id
}
- Test, S.Gz - Week 1'
)
class
WeeklyReportCommentTest
(
APITestCase
):
...
...
diet_questionnaire/tests.py
View file @
21d8da7b
...
...
@@ -64,7 +64,7 @@ class DietQuestionnaireTests(APITestCase):
def
test_string_representation
(
self
):
self
.
assertEqual
(
str
(
self
.
diet_questionnaire
),
'email@email.com'
)
self
.
assertEqual
(
str
(
self
.
diet_questionnaire
),
f
'email@email.com
+
{
self
.
custom_user_1
.
id
}
'
)
def
test_get_all_diet_questionnaire
(
self
):
self
.
client
.
credentials
(
HTTP_AUTHORIZATION
=
self
.
login_credentials
)
...
...
profile_dietku/tests.py
View file @
21d8da7b
...
...
@@ -306,7 +306,7 @@ class DietRecommendationTests(APITestCase):
cls
.
login_credentials
=
"Bearer "
+
cls
.
json_login_response
[
'access_token'
]
def
test_string_representation
(
self
):
self
.
assertEqual
(
str
(
self
.
diet_recommendation
),
'email2@email.com - Test, S.Gz'
)
self
.
assertEqual
(
str
(
self
.
diet_recommendation
),
f
'email2@email.com
+
{
self
.
custom_user_2
.
id
}
- Test, S.Gz'
)
def
test_create_diet_recommendation_succeed
(
self
):
tmp_file
=
SimpleUploadedFile
(
"testfile.pdf"
,
bytes
(
"abc"
,
'utf-8'
),
content_type
=
"application/pdf"
)
...
...
Write
Preview
Supports
Markdown
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