class TestProjectCreated(unittest.TestCase): """ Tests for anitya_schema.project_messages.ProjectCreated class. """ def setUp(self): """ Set up the tests. """ self.message = ProjectCreated() @mock.patch( "anitya_schema.project_messages.ProjectCreated.summary", new_callable=mock.PropertyMock, ) def test__str__(self, mock_property): """ Assert that correct string is returned. """ mock_property.return_value = "Dummy" self.assertEqual(self.message.__str__(), "Dummy") @mock.patch( "anitya_schema.project_messages.ProjectCreated.name", new_callable=mock.PropertyMock, ) def test_summary(self, mock_property): """ Assert that correct summary string is returned. """ mock_property.return_value = "Dummy" exp = "A new project, Dummy, was added to release-monitoring." self.assertEqual(self.message.summary, exp) def test_name(self): """ Assert that name string is returned. """ self.message.body = {"project": {"name": "Dummy"}} self.assertEqual(self.message.name, "Dummy")
def setUp(self): """ Set up the tests. """ self.message = ProjectCreated()
def setUp(self): """Set up the tests.""" # We can't use ProjectMessage directly, # so we will use something that inherits it self.message = ProjectCreated()