def test_should_assign_some_attributes(self): metadata = Metadata() metadata.author = 'John Smith' metadata.title = 'Lorem ipsum' self.assertEqual('Metadata(author="John Smith", title="Lorem ipsum")', str(metadata))
def test_should_encode_unicode_with_utf8(self): metadata = Metadata() metadata.author = 'zażółć gęślą' metadata.title = 'jaźń' self.assertEqual('Metadata(author="zażółć gęślą", title="jaźń")', str(metadata)) self.assertEqual('Metadata(author="zażółć gęślą", title="jaźń")', repr(metadata))
def test_should_assign_all_attributes(self): metadata = Metadata() metadata.author = 'John Smith' metadata.creator = 'Mark Brown' metadata.keywords = 'foo bar' metadata.subject = 'Dolor sit amet' metadata.title = 'Lorem ipsum' self.assertEqual('Metadata(author="John Smith", creator="Mark Brown", keywords="foo bar", subject="Dolor sit amet", title="Lorem ipsum")', str(metadata))
def test_should_update_metadata(self, mock_set_title, mock_set_subject, mock_set_keywords, mock_set_creator, mock_set_author): metadata = Metadata() metadata.author = 'John Smith' metadata.creator = 'Mark Brown' metadata.keywords = 'foo bar' metadata.subject = 'Dolor sit amet' metadata.title = 'Lorem ipsum' Canvas().update_metadata(metadata) mock_set_author.assert_called_once_with('John Smith') mock_set_creator.assert_called_once_with('Mark Brown') mock_set_keywords.assert_called_once_with('foo bar') mock_set_subject.assert_called_once_with('Dolor sit amet') mock_set_title.assert_called_once_with('Lorem ipsum')