def test_copy_sheet_allows_other_users_to_copy_public_sheets(self):
        user = User(username='******')
        user.save()
        worksheet = Worksheet()
        worksheet.a1.value = 'some-cell-content'
        sheet = Sheet()
        sheet.owner = user
        sheet.is_public = True
        sheet.jsonify_worksheet(worksheet)
        sheet.save()
        original_sheet_id = sheet.id
        other_user = User(username='******')
        other_user.save()

        retval = copy_sheet_to_user(sheet, other_user)

        other_user_sheets = Sheet.objects.filter(owner=other_user)
        self.assertEquals(len(other_user_sheets), 1)
        copied_sheet = other_user_sheets[0]
        self.assertFalse(copied_sheet.is_public)
        copied_worksheet = copied_sheet.unjsonify_worksheet()
        self.assertEquals(copied_worksheet.a1.value, 'some-cell-content')
        self.assertEquals(copied_sheet.id, retval.id)
        self.assertNotEquals(retval.id, original_sheet_id)
예제 #2
0
 def _inner(user):
     _, __, kwargs = resolve(next_url)
     sheet_id = kwargs['sheet_id']
     copy_sheet_to_user(Sheet.objects.get(id=sheet_id), user)
예제 #3
0
 def _inner(user):
     _, __, kwargs = resolve(next_url)
     sheet_id = kwargs['sheet_id']
     copy_sheet_to_user(Sheet.objects.get(id=sheet_id), user)