January 2018
Intermediate to advanced
366 pages
9h 7m
English
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, ...
Read now
Unlock full access