Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
b1fd1143
Commit
b1fd1143
authored
Dec 04, 2019
by
Fajrin Kingwijati
Browse files
Add unit test for models/accounts.py
parent
a13a6f7e
Pipeline
#26623
passed with stages
in 6 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/tests/test_account_models.py
0 → 100644
View file @
b1fd1143
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
core.models.accounts
import
Company
,
Student
,
Supervisor
class
CompanyTest
(
TestCase
):
def
test_company_creation
(
self
):
user
=
User
.
objects
.
create_user
(
'dummy.login.company'
,
'dummy.login.company@company.com'
,
'lalala123'
)
company
=
Company
.
objects
.
create
(
user
=
user
,
description
=
"lalalala"
,
status
=
Company
.
VERIFIED
,
logo
=
None
,
address
=
None
,
category
=
"perusahaan listrik"
,
size
=
"20"
,
website
=
"www.www"
,
linkedin_url
=
None
)
self
.
assertTrue
(
isinstance
(
company
,
Company
))
self
.
assertEqual
(
company
.
name
.
title
(),
"Dummy.Login.Company"
)
def
test_supervisor_creation
(
self
):
user
=
User
.
objects
.
create_user
(
'dummy.login.supervisor'
,
'dummy.login.supervisor@supervisor.com'
,
'lalala123'
)
supervisor
=
Supervisor
.
objects
.
create
(
user
=
user
,
nip
=
100000000
)
self
.
assertTrue
(
isinstance
(
supervisor
,
Supervisor
))
self
.
assertEqual
(
supervisor
.
name
.
title
(),
"Dummy.Login.Supervisor"
)
def
test_student_creation
(
self
):
user
=
User
.
objects
.
create_user
(
'dummy.login.student'
,
'dummy.login.student@student.com'
,
'lalala123'
)
student
=
Student
.
objects
.
create
(
user
=
user
,
npm
=
1606837631
,
resume
=
None
,
sertifikat
=
None
,
phone_number
=
"081291693790"
,
gender
=
"laki-laki"
,
birth_place
=
"Jakarta"
)
self
.
assertTrue
(
isinstance
(
student
,
Student
))
self
.
assertEqual
(
student
.
name
.
title
(),
"Dummy.Login.Student"
)
\ No newline at end of file
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