Fakultas Ilmu Komputer UI

Verified Commit f0688243 authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[RED] Add test for seed_users command

parent 0d693d7e
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()))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment