[python-oca] create new repo
This commit is contained in:
commit
b202172a30
78 changed files with 4703 additions and 0 deletions
40
oca/tests/test_user.py
Normal file
40
oca/tests/test_user.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
|
||||
import oca
|
||||
|
||||
|
||||
class TestUser(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.client = oca.Client('test:test')
|
||||
self.xml = open(os.path.join(os.path.dirname(oca.__file__),
|
||||
'tests/fixtures/user.xml')).read()
|
||||
|
||||
def test_allocate(self):
|
||||
self.client.call = Mock(return_value=1)
|
||||
assert oca.User.allocate(self.client, 'jon', 'secret') == 1
|
||||
|
||||
def test_repr(self):
|
||||
u = oca.User(self.xml, self.client)
|
||||
assert u.__repr__() == '<oca.User("dan")>'
|
||||
|
||||
def test_change_passwd(self):
|
||||
self.client.call = Mock(return_value='')
|
||||
u = oca.User(self.xml, self.client)
|
||||
u.change_passwd('secret2')
|
||||
self.client.call.assert_called_once_with('user.passwd', '3', 'secret2')
|
||||
|
||||
def test_delete(self):
|
||||
self.client.call = Mock(return_value='')
|
||||
vm = oca.User(self.xml, self.client)
|
||||
vm.delete()
|
||||
self.client.call.assert_called_once_with('user.delete', '3')
|
||||
|
||||
def test_change_group(self):
|
||||
self.client.call = Mock(return_value='')
|
||||
vm = oca.User(self.xml, self.client)
|
||||
vm.chgrp(3)
|
||||
self.client.call.assert_called_once_with('user.chgrp', '3', 3)
|
||||
Loading…
Add table
Add a link
Reference in a new issue