def test_we_cant_add_attachment_without_id(attachment_return): bug = Bug() attachment = Attachment(None, **attachment_return['bugs']['1017315'][0]) try: bug.add_attachment(attachment) except BugException as e: assert str( e ) == "Message: Cannot add an attachment without a bug id Code: None"