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
2020
PPL-C
Diskominfo-D'Blood
Mantan Aab-D Blood
Commits
f0688243
Verified
Commit
f0688243
authored
Jun 20, 2020
by
Giovan Isa Musthofa
Browse files
[RED] Add test for seed_users command
parent
0d693d7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/main/test_commands.py
0 → 100644
View file @
f0688243
from
io
import
StringIO
from
django.core.management
import
call_command
from
django.test
import
TestCase
from
.models
import
User
class
SeedUserTest
(
TestCase
):
def
test_command_success
(
self
):
out
=
StringIO
()
users_amount
=
len
(
User
.
objects
.
filter
())
call_command
(
'seed_users'
,
stdout
=
out
)
self
.
assertIn
(
'Successfully seeds 100 users.'
,
out
.
getvalue
())
self
.
assertEqual
(
users_amount
+
100
,
len
(
User
.
objects
.
filter
()))
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