def test_get_vendor_ok_response(self, mock_vendor_repo_get): '''Test get_vendor OK response. ''' # Arrange with self.app.app_context(): mock_vendor_repo_get.return_value = self.mock_vendor vendor_controller = VendorController(self.request_context) # Act result = vendor_controller.get_vendor(1) # Assert assert result.status_code == 200 assert result.get_json()['msg'] == 'OK'
def test_get_vendor_when_vendor_doesnot_exist(self, mock_vendor_repo_get): '''Test get_vendor when the vendor doesnot exist. ''' # Arrange with self.app.app_context(): mock_vendor_repo_get.return_value = None vendor_controller = VendorController(self.request_context) # Act result = vendor_controller.get_vendor(1) # Assert assert result.status_code == 400 assert result.get_json()['msg'] == 'Bad Request - Invalid or ' \ 'Missing vendor_id'