Skip to content

TypeError: Type not serializable #45

Description

@japo32

Hi, I have the following test below that puts simple text into an object:

from nose2.compat import unittest
import boto3
import placebo

class S3PlaceboTestCase(unittest.TestCase):

    def setUp(self):
        super().setUp()
        self.session = boto3.Session()


class S3PlaceboRecordCase(S3PlaceboTestCase):

    def setUp(self):
        super().setUp()
        path = 'responses'
        self.pill = placebo.attach(self.session, data_path=path)
        self.pill.record(services='s3')
        self.s3 = self.session.client("s3")

    def tearDown(self):
        super().tearDown()
        self.pill.stop()

    def test_pill_record(self):
        self.s3.put_object(Bucket='my_bucket', ContentType='text/plain', Key='pill_test.txt', Body='Sample text')
        obj = self.s3.get_object(Bucket='my_bucket, Key='pill_test.txt')
        self.s3.delete_object(Bucket='my_bucket', Key='pill_test.txt')
        self.assertTrue(True)

And when I run the test I'm getting:

  File "/usr/share/stuff-site-adcontrol/.test-venv/lib/python3.4/site-packages/placebo/serializer.py", line 60, in serialize
    raise TypeError("Type not serializable")
TypeError: Type not serializable

Which is strange because it's simple text.

Might be related to #5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions