|
| 1 | +""" |
| 2 | +Copyright 2022 Google LLC |
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +you may not use this file except in compliance with the License. |
| 5 | +You may obtain a copy of the License at |
| 6 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +Unless required by applicable law or agreed to in writing, software |
| 8 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +See the License for the specific language governing permissions and |
| 11 | +limitations under the License. |
| 12 | +""" |
| 13 | + |
| 14 | +import unittest |
| 15 | + |
| 16 | +import sheets_append_values |
| 17 | +from base_test import BaseTest |
| 18 | + |
| 19 | + |
| 20 | +class Testappendvalues(BaseTest): |
| 21 | + """Unit test for append value Sheet snippet""" |
| 22 | + |
| 23 | + def test_append_values(self): |
| 24 | + """test append values function""" |
| 25 | + spreadsheet_id = self.create_test_spreadsheet() |
| 26 | + self.populate_values(spreadsheet_id) |
| 27 | + result = sheets_append_values.append_values(spreadsheet_id, |
| 28 | + 'Sheet1', 'USER_ENTERED', [ |
| 29 | + ['A', 'B'], |
| 30 | + ['C', 'D'] |
| 31 | + ]) |
| 32 | + self.assertIsNotNone(result) |
| 33 | + self.assertEqual('Sheet1!A1:J10', result.get('tableRange')) |
| 34 | + updates = result.get('updates') |
| 35 | + self.assertEqual('Sheet1!A11:B12', updates.get('updatedRange')) |
| 36 | + self.assertEqual(2, updates.get('updatedRows')) |
| 37 | + self.assertEqual(2, updates.get('updatedColumns')) |
| 38 | + self.assertEqual(4, updates.get('updatedCells')) |
| 39 | + |
| 40 | + |
| 41 | +if __name__ == "__main__": |
| 42 | + unittest.main() |
0 commit comments