Example #1
0
    def test_upload_new_version(self):
        upload_file(self.egnyte, FILE_FIRST_VERSION_NAME, self.filepath)
        second_version = upload_file(self.egnyte, FILE_SECOND_VERSION_NAME,
                                     self.filepath)
        file_attributes = second_version._fetch_attributes()

        self.assertEqual(file_attributes['num_versions'], 2)
Example #2
0
    def test_delete_file(self):
        uploaded_file = upload_file(self.egnyte, FILE_FIRST_VERSION_NAME,
                                    self.filepath)

        self.assertIsNone(uploaded_file.check())

        uploaded_file.delete()

        with self.assertRaises(exc.NotFound):
            uploaded_file.check()
Example #3
0
    def test_copy_file(self):
        destination = self.root_folder.folder(DESTINATION_FOLDER_NAME)
        destination.create()
        uploaded_file = upload_file(self.egnyte, FILE_FIRST_VERSION_NAME,
                                    self.filepath)

        copied_file = uploaded_file.copy(destination.path +
                                         EGNYTE_FILE_NAME_IMAGE)

        self.assertIsNone(uploaded_file.check())
        self.assertIsNone(copied_file.check())
Example #4
0
    def test_delete_file_comment(self):
        uploaded_file = upload_file(self.egnyte, FILE_NAME, self.filepath)
        comment = uploaded_file.add_note(COMMENT)

        all_comments = self.egnyte.notes.list()

        self.assertIn(comment, all_comments)

        comment.delete()
        all_comments = self.egnyte.notes.list()

        self.assertNotIn(comment, all_comments)
Example #5
0
    def test_move_file(self):
        destination = self.root_folder.folder(DESTINATION_FOLDER_NAME)
        destination.create()
        uploaded_file = upload_file(self.egnyte, FILE_FIRST_VERSION_NAME,
                                    self.filepath)

        moved_file = uploaded_file.move(destination.path +
                                        EGNYTE_FILE_NAME_IMAGE)

        with self.assertRaises(exc.NotFound):
            uploaded_file.check()
        self.assertIsNone(moved_file.check())
Example #6
0
    def test_list_comments(self):
        uploaded_file = upload_file(self.egnyte, FILE_NAME, self.filepath)
        comment = uploaded_file.add_note(COMMENT)

        all_comments = self.egnyte.notes.list()

        self.assertIn(comment, all_comments)
        self.assertEqual(uploaded_file, comment.get_file())

        comments = uploaded_file.get_notes()

        self.assertEqual(tuple(comments), (comment, ))

        comment.delete()
        comments = uploaded_file.get_notes()

        self.assertEqual(tuple(comments), ())

        all_comments = self.egnyte.notes.list()

        self.assertNotIn(comment, all_comments)
Example #7
0
    def test_create_file_link(self):
        uploaded_file = upload_file(self.egnyte, FILE_NAME, self.filepath)
        link = uploaded_file.link(ACCESSIBILITY_ANYONE)

        self.__verify_link(link[0], self.filepath, ACCESSIBILITY_ANYONE,
                           'file')
Example #8
0
    def test_create_file_comment(self):
        uploaded_file = upload_file(self.egnyte, FILE_NAME, self.filepath)
        comment = uploaded_file.add_note(COMMENT)

        self.assertEqual(comment.file_path, self.filepath)
        self.assertEqual(comment.message, COMMENT)
Example #9
0
    def test_upload_file(self):
        uploaded_file = upload_file(self.egnyte, FILE_FIRST_VERSION_NAME,
                                    self.filepath)

        self.assertIsNone(uploaded_file.check())