

def test_restore_resources(self):
    'Give resource to a domain admin and restore them.'
    self._create_domain('domain.tld')
    dom = Domain.objects.get(name='domain.tld')
    self._create_account('admin1@domain.tld', role='DomainAdmins')
    user = User.objects.get(username='admin1@domain.tld')
    values = {
        'username': user.username,
        'role': user.group,
        'quota_act': True,
        'is_active': user.is_active,
        'email': user.email,
        'mailboxes_limit': 1,
        'mailbox_aliases_limit': 2,
    }
    self.ajax_post(reverse('admin:account_change', args=[user.id]), values)
    dom.add_admin(user)
    self.client.logout()
    self.client.login(username='admin1@domain.tld', password='Toto1234')
    self._create_account('user1@domain.tld')
    self._create_alias('alias1@domain.tld', 'user1@domain.tld')
    self._create_alias('alias2@domain.tld', 'user1@domain.tld')
    self.client.logout()
    self.client.login(username='reseller', password='toto')
    self.ajax_post(reverse('admin:account_delete', args=[user.id]), {
        
    })
    self._check_limit('mailboxes', 1, 2)
    self._check_limit('mailbox_aliases', 2, 2)

dataset/ETHPy150Open tonioo/modoboa/modoboa/limits/tests/test_user_limits.py ResellerTestCase.test_restore_resources/original