

@test.create_stubs({
    api.keystone: ('user_create', 'get_default_domain', 'add_tenant_user_role', 'tenant_list', 'get_default_role', 'roles_for_user', 'role_list'),
})
def test_create_with_empty_email(self):
    user = self.users.get(id='5')
    domain = self._get_default_domain()
    domain_id = domain.id
    role = self.roles.first()
    api.keystone.get_default_domain(IgnoreArg()).MultipleTimes().AndReturn(domain)
    api.keystone.tenant_list(IgnoreArg(), domain=domain_id, user=None).AndReturn([self.tenants.list(), False])
    api.keystone.user_create(IgnoreArg(), name=user.name, email=user.email, password=user.password, project=self.tenant.id, enabled=True, domain=domain_id).AndReturn(user)
    api.keystone.role_list(IgnoreArg()).AndReturn(self.roles.list())
    api.keystone.get_default_role(IgnoreArg()).AndReturn(role)
    api.keystone.add_tenant_user_role(IgnoreArg(), self.tenant.id, user.id, role.id)
    api.keystone.roles_for_user(IgnoreArg(), user.id, self.tenant.id)
    self.mox.ReplayAll()
    formData = {
        'method': 'CreateUserForm',
        'domain_id': domain_id,
        'name': user.name,
        'email': '',
        'password': user.password,
        'project': self.tenant.id,
        'role_id': self.roles.first().id,
        'confirm_password': user.password,
    }
    res = self.client.post(USER_CREATE_URL, formData)
    self.assertNoFormErrors(res)
    self.assertMessageCount(success=1)

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/identity/users/tests.py UsersViewTests.test_create_with_empty_email/original