Exemplo n.º 1
0
 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 == '*****@*****.**'
Exemplo n.º 2
0
def test_createsuperuser_username_validation(input):
    responses = ['', 'myusername']
    input.side_effect = lambda *args: responses.pop(0)
    command = CreateSuperUser()
    assert command.get_value('username') == 'myusername'
Exemplo n.º 3
0
def test_createsuperuser_email_validation(input):
    responses = ['', 'myemail', '*****@*****.**']
    input.side_effect = lambda *args: responses.pop(0)
    command = CreateSuperUser()
    assert command.get_value('email') == '*****@*****.**'