예제 #1
0
    def test_init_all_arguments(self):
        """
        Avatar can also be initialized with argument and the exported
        attributes are read only.
        """
        avatar = FilesystemAvatar(
            name=mk.getUniqueString(),
            home_folder_path=u'some-path',
            root_folder_path=u'other-path',
            token=u'the-token',
            virtual_folders=(
                (['base', 'segment'], '/some/real/path'),
                (['other', 'segment'], 'c:\\other\\path'),
                )
            )

        self.assertEqual(u'other-path', avatar.root_folder_path)
        with self.assertRaises(AttributeError):
            avatar.root_folder_path = 'something'

        self.assertEqual(u'the-token', avatar.token)
        with self.assertRaises(AttributeError):
            avatar.token = 'something'

        self.assertEqual(
            (
                (['base', 'segment'], '/some/real/path'),
                (['other', 'segment'], 'c:\\other\\path'),
                ),
            avatar.virtual_folders,
            )
        with self.assertRaises(AttributeError):
            avatar.virtual_folders = 'something'
예제 #2
0
    def test_getPrivilegeState_invalid(self):
        """
        Return `absent` for unknown names.
        """
        privilege = mk.getUniqueString()

        result = self.capabilities._getPrivilegeState(privilege)

        self.assertEqual(u"absent", result)
예제 #3
0
    def test_init_all_arguments(self):
        """
        Avatar can also be initialized with a root path.
        """
        avatar = FilesystemAvatar(
            name=mk.getUniqueString(), home_folder_path=u"some-path", root_folder_path=u"other-path", token=u"the-token"
        )

        self.assertEqual(u"other-path", avatar.root_folder_path)
        self.assertEqual(u"the-token", avatar.token)
예제 #4
0
    def test_init(self):
        """
        Avatar can be initialized with credentials and home_folder_path.
        """
        name = mk.getUniqueString()
        avatar = FilesystemAvatar(name=name, home_folder_path=mk.fs.temp_path)

        with self.assertRaises(NotImplementedError):
            avatar.use_impersonation

        self.assertEqual(mk.fs.temp_path, avatar.home_folder_path)
        self.assertEqual(name, avatar.name)
        self.assertIsNone(avatar.root_folder_path)