def test_should_call_worksheets_without_name_untitled(self):
     json = '{"something": "else"}'
     try:
         result = api_json_to_worksheet(json)
     except KeyError:
         self.fail('shouldnt barf on worksheet with no name')
     self.assertEquals(result.name, 'Untitled')
Exemple #2
0
 def test_should_call_worksheets_without_name_untitled(self):
     json = '{"something": "else"}'
     try:
         result = api_json_to_worksheet(json)
     except KeyError:
         self.fail('shouldnt barf on worksheet with no name')
     self.assertEquals(result.name, 'Untitled')
 def test_should_copy_errors_across(self):
     json = '''
         {
             "usercode_error" : {"message": "ohno!", "something": "else"}
         }
     '''
     try:
         result = api_json_to_worksheet(json)
     except KeyError:
         self.fail('shouldnt barf on worksheet with error')
     self.assertTrue(isinstance(result, Worksheet))
     self.assertEquals(
         result._usercode_error,
         {"message": "ohno!", "something": "else"}
     )
Exemple #4
0
 def test_should_copy_errors_across(self):
     json = '''
         {
             "usercode_error" : {"message": "ohno!", "something": "else"}
         }
     '''
     try:
         result = api_json_to_worksheet(json)
     except KeyError:
         self.fail('shouldnt barf on worksheet with error')
     self.assertTrue(isinstance(result, Worksheet))
     self.assertEquals(result._usercode_error, {
         "message": "ohno!",
         "something": "else"
     })
    def test_values(self):
        json = u'''
        {
            "name": "sheetname",
            "1": {
                "2": "abc",
                "3": "123",
                "4": 123,
                "5": [1, 2, 3, 4],
                "6": "unescaped & unicod\xe9"
            }
        }
        '''
        actual = api_json_to_worksheet(json)
        expected = Worksheet()
        expected.name = 'sheetname'
        expected[1, 2].value = 'abc'
        expected[1, 3].value = '123'
        expected[1, 4].value = 123
        expected[1, 5].value = [1L, 2L, 3L, 4L]
        expected[1, 6].value = u'unescaped & unicod\xe9'

        self.assertEquals(actual, expected)
Exemple #6
0
    def test_values(self):
        json = u'''
        {
            "name": "sheetname",
            "1": {
                "2": "abc",
                "3": "123",
                "4": 123,
                "5": [1, 2, 3, 4],
                "6": "unescaped & unicod\xe9"
            }
        }
        '''
        actual = api_json_to_worksheet(json)
        expected = Worksheet()
        expected.name = 'sheetname'
        expected[1, 2].value = 'abc'
        expected[1, 3].value = '123'
        expected[1, 4].value = 123
        expected[1, 5].value = [1L, 2L, 3L, 4L]
        expected[1, 6].value = u'unescaped & unicod\xe9'

        self.assertEquals(actual, expected)