def test_suspend_vendor_ok_response(self, mock_vendor_repo_update, mock_vendor_repo_get): '''Test suspend_vendor OK response. ''' # Arrange with self.app.app_context(): mock_vendor_repo_get.return_value = self.mock_vendor mock_vendor_repo_update.return_value = self.mock_vendor vendor_controller = VendorController(self.request_context) # Act result = vendor_controller.suspend_vendor(1) # Assert assert result.status_code == 200 assert result.get_json()['msg'] == 'OK'
def test_suspend_vendor_when_vendor_doesnot_exist(self, mock_vendor_repo_get): '''Test suspend_vendor when 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.suspend_vendor(1) # Assert assert result.status_code == 400 assert result.get_json()['msg'] == 'Invalid or incorrect ' \ 'vendor_id provided'