def test_write(self, drive, auth):
        items_to_write = self.get_items_to_write()
        options = self.get_options()

        writer = GDriveWriter(options, meta())
        writer.write_batch(items_to_write)
        writer.flush()
        writer.close()
        drive.assert_has_calls([('call().CreateFile().Upload()', (mock.ANY,))])
Example #2
0
    def test_write(self, drive, auth):
        items_to_write = self.get_items_to_write()
        options = self.get_options()

        writer = GDriveWriter(options, meta())
        writer.write_batch(items_to_write)
        writer.flush()
        writer.close()
        drive.assert_has_calls([('call().CreateFile().Upload()', (mock.ANY, ))
                                ])
    def test_write_blob_consistency(self, drive, auth):
        drive().CreateFile()['size'] = 999
        drive().CreateFile()['md5Checksum'] = "a"*24
        # given
        items_to_write = self.get_items_to_write()
        options = self.get_options()
        options['options']['check_consistency'] = True

        # when:
        writer = GDriveWriter(options, meta())
        try:
            writer.write_batch(items_to_write)
            writer.flush()
        finally:
            writer.close()

        with self.assertRaises(InconsistentWriteState):
            writer.finish_writing()
Example #4
0
    def test_write_blob_consistency(self, drive, auth):
        drive().CreateFile()['size'] = 999
        drive().CreateFile()['md5Checksum'] = "a" * 24
        # given
        items_to_write = self.get_items_to_write()
        options = self.get_options()
        options['options']['check_consistency'] = True

        # when:
        writer = GDriveWriter(options, meta())
        try:
            writer.write_batch(items_to_write)
            writer.flush()
        finally:
            writer.close()

        with self.assertRaises(InconsistentWriteState):
            writer.finish_writing()