Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-10-05 14:08:30 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-10-05 14:08:30 (GMT)
commit1c7a9ebd496807e3528aacac952602763d51f8e2 (patch)
tree96d93d055871cc1ea17de016a812042055e3ccaf /tests
parent37430cd6e8d348ca00e70f776c2c6321a43dd46a (diff)
Allow users changing their own metadata
Diffstat (limited to 'tests')
-rwxr-xr-xtests/units/node.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/units/node.py b/tests/units/node.py
index 9a2689b..e0bd295 100755
--- a/tests/units/node.py
+++ b/tests/units/node.py
@@ -180,6 +180,23 @@ class NodeTest(tests.Test):
call(cp, method='GET', cmd='probe1', document='document', guid=guid, principal='principal')
call(cp, method='GET', cmd='probe2', document='document', guid=guid)
+ def test_ForbiddenCommandsForUserResource(self):
+ cp = NodeCommands(Volume('db', [User]))
+
+ call(cp, method='POST', document='user', principal='fake', content={
+ 'name': 'user1',
+ 'color': '',
+ 'machine_sn': '',
+ 'machine_uuid': '',
+ 'pubkey': tests.PUBKEY,
+ })
+ self.assertEqual('user1', call(cp, method='GET', document='user', guid=tests.UID, prop='name'))
+
+ self.assertRaises(Unauthorized, call, cp, method='PUT', document='user', guid=tests.UID, content={'name': 'user2'})
+ self.assertRaises(ad.Forbidden, call, cp, method='PUT', document='user', guid=tests.UID, principal='fake', content={'name': 'user2'})
+ call(cp, method='PUT', document='user', guid=tests.UID, principal=tests.UID, content={'name': 'user2'})
+ self.assertEqual('user2', call(cp, method='GET', document='user', guid=tests.UID, prop='name'))
+
def test_SetUser(self):
cp = NodeCommands(Volume('db'))