Пример #1
0
    def test_create_sheet_invalid_no_columns(self):
        self.client.as_test_scenario('Create Sheet - Invalid - No Columns')

        new_sheet = Sheet({"name": "New Sheet", "columns": ExplicitNull()})

        with pytest.raises(ApiError) as e:
            self.client.Home.create_sheet(new_sheet)

        self.check_error_code(e, 1054)
    def test_update_rows_clear_value_predecessor_list(self):
        self.client.as_test_scenario(
            'Update Rows - Clear Value - Predecessor List')

        row = Row()
        row.id = 10
        row.cells.append({'columnId': 123, 'value': ExplicitNull()})

        response = self.client.Sheets.update_rows(1, [row])

        assert response.result[0].cells[0].column_id == 123
        assert response.result[0].cells[0].value is None
    def test_update_rows_clear_value_cell_link(self):
        self.client.as_test_scenario('Update Rows - Clear Value - Cell Link')

        first_row = Row()
        first_row.id = 10
        first_row.cells.append({"columnId": 101, "value": ""})
        first_row.cells[0].link_in_from_cell = ExplicitNull()

        response = self.client.Sheets.update_rows(1, [first_row])

        assert response.result[0].cells[0].column_id == 101
        assert response.result[0].cells[0].value is None
        assert response.result[0].cells[0].link_in_from_cell is None
Пример #4
0
    def test_container_destination_serialization(self):
        pytest.skip('Skipping until mock API test is updated')
        pytest.skip('Models currently have no concept of a nullable / optional type')

        self.client.as_test_scenario('Serialization - Container Destination')

        response = self.client.Folders.copy_folder(1, ContainerDestination({
            'destinationType': 'home',
            'destinationId': ExplicitNull(),
            'newName': 'Copy of Some Folder'
        }))

        assert response.result.id == 2
    def test_update_rows_clear_value_hyperlink(self):
        self.client.as_test_scenario('Update Rows - Clear Value - Hyperlink')

        first_row = Row()
        first_row.id = 10
        first_row.cells.append({
            "columnId": 101,
            "value": "",
            "hyperlink": ExplicitNull()
        })

        response = self.client.Sheets.update_rows(1, [first_row])

        assert response.result[0].cells[0].column_id == 101
        assert response.result[0].cells[0].value is None
        assert response.result[0].cells[0].hyperlink is None
Пример #6
0
    def test_cell_link_serialization(self):
        pytest.skip('Skipping until mock API test is updated')
        self.client.as_test_scenario('Serialization - Cell Link')

        updated_row = Row()
        updated_row.id = 2
        updated_row.cells.append({
            'columnId': 3,
            'value': ExplicitNull(),
            'linkInFromCell': {
                'sheetId': 4,
                'rowId': 5,
                'columnId': 6
            }
        })

        self.client.Sheets.update_rows(1, updated_row)