def test_creates_user(self, input): responses = { 'Username: '******'myusername', 'Email: ': '*****@*****.**', } input.side_effect = lambda label: responses[label] count = UserProfile.objects.count() CreateSuperUser().handle() assert UserProfile.objects.count() == count + 1 user = UserProfile.objects.get(username='******') assert user.email == '*****@*****.**'
def test_createsuperuser_username_validation(input): responses = ['', 'myusername'] input.side_effect = lambda *args: responses.pop(0) command = CreateSuperUser() assert command.get_value('username') == 'myusername'
def test_createsuperuser_email_validation(input): responses = ['', 'myemail', '*****@*****.**'] input.side_effect = lambda *args: responses.pop(0) command = CreateSuperUser() assert command.get_value('email') == '*****@*****.**'