Ejemplo n.º 1
0
	def test_permissions_modify_file_permissions_by_key(self):
		permission = Permissions(True,True,True)
		key = ps.add_file_permissions(ndb.Key("fk","mfpk"),ndb.Key("uk","mfpk"),permission)

		new_permissions = Permissions(False,False,False)
		ps.modify_file_permissions_by_key(key, new_permissions)
		retrieved = ps.get_permissions_by_key(key)

		self.assertEqual(new_permissions.read, retrieved.read)
		self.assertEqual(new_permissions.write, retrieved.write)
		self.assertEqual(new_permissions.full_control, retrieved.full_control)
Ejemplo n.º 2
0
	def test_permissions_get_permissions_by_key(self):
		user_key = ndb.Key("uk","gpbk")
		file_key = ndb.Key("fk","gpbk")
		perms = Permissions(True,True,True)
		key = ps.add_file_permissions(file_key,user_key,perms)

		obj = ps.get_permissions_by_key(key)
		self.assertEqual(obj.user_key, user_key)
		self.assertEqual(obj.file_key, file_key)
		self.assertEqual(obj.read, perms.read)
		self.assertEqual(obj.write, perms.write)
		self.assertEqual(obj.full_control, perms.full_control)
Ejemplo n.º 3
0
	def test_permissions_revoke_permissions_by_key(self):
		key = ps.add_file_permissions(ndb.Key("fk","rpbk"),ndb.Key("uk","rpbk"),Permissions(True,True,True))
		ps.revoke_permissions_by_key(key)

		self.assertIsNone(ps.get_permissions_by_key(key))