Writing the integration tests

Right now, we have the declared test class. In this class, we will create two tests. In the first test, using test_add_news, we will see if we can add a news article starting from our orchestrator; in the second test, using get_all_news, we will check if we can get a news article starting from our orchestrator:

 class TestNewsService(BaseTestCase): def test_add_news(self): """Test to insert a News to the database.""" with self.client: response = self.client.post( '/famous', data=json.dumps(dict( title='My Test', content='Just a service test', author='unittest', tags=['Test', 'Functional_test'], )), content_type='application/json', ) data = json.loads(response.data.decode()) self.assertEqual(response.status_code, ...

Get Microservice Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.