How to use submit method in pom

Best Python code snippet using pom_python

views.py

Source:views.py Github

copy

Full Screen

...76 stat = Statistics(problem=submit.problem)77 stat.save()78@login_required79@public_auth80def public_submit(request):81 problem_list = Problem.objects.filter(is_public=True).order_by('title')82 if request.method == "POST":83 form = SubmitAnswer(request.POST, request.FILES)84 form.fields['problem'].queryset = problem_list85 if form.is_valid():86 post = form.save(commit=False)87 post.submit_time = timezone.now()88 post.user = request.user89 post.submit_file = None90 post.save()91 post.submit_file = request.FILES.get('submit_file')92 post.save()93 result = judge(file_name=post.submit_file.path,94 problem=post.problem, language=post.language, submit=post)...

Full Screen

Full Screen

asyncActions.spec.js

Source:asyncActions.spec.js Github

copy

Full Screen

...116 const payload = { type: 'address', formValues: address };117 await submitAddress(payload)(...thunkArgs);118 expect(dispatch).toHaveBeenNthCalledWith(119 1,120 actions.address.submit(payload)121 );122 expect(dispatch).toHaveBeenNthCalledWith(2, actions.address.accept());123 expect(dispatch).toHaveBeenCalledTimes(2);124 });125 test('submitAddress thunk saves to storage on success', async () => {126 const payload = { type: 'address', formValues: address };127 await submitAddress(payload)(...thunkArgs);128 expect(mockSetItem).toHaveBeenCalledWith('address', address);129 });130 test('submitAddress thunk throws if there is no guest cart', async () => {131 const payload = { type: 'address', formValues: address };132 getState.mockImplementationOnce(() => ({133 cart: {},134 directory: { countries }135 }));136 await expect(submitAddress(payload)(...thunkArgs)).rejects.toThrow(137 'guestCartId'138 );139 });140 test('submitAddress thunk throws if payload is invalid', async () => {141 const payload = { type: 'address', formValues: {} };142 await expect(submitAddress(payload)(...thunkArgs)).rejects.toThrow();143 expect(dispatch).toHaveBeenNthCalledWith(144 1,145 actions.address.submit(payload)146 );147 expect(dispatch).toHaveBeenCalledTimes(1);148 });149});150describe('submitPaymentMethod', () => {151 test('submitPaymentMethod() returns a thunk', () => {152 expect(submitPaymentMethod()).toBeInstanceOf(Function);153 });154 test('submitPaymentMethod thunk returns undefined', async () => {155 const payload = {156 type: 'paymentMethod',157 formValues: { paymentMethod }158 };159 const result = await submitPaymentMethod(payload)(...thunkArgs);160 expect(result).toBeUndefined();161 });162 test('submitPaymentMethod thunk dispatches actions on success', async () => {163 const payload = {164 type: 'paymentMethod',165 formValues: { paymentMethod }166 };167 await submitPaymentMethod(payload)(...thunkArgs);168 expect(dispatch).toHaveBeenNthCalledWith(169 1,170 actions.paymentMethod.submit(payload)171 );172 expect(dispatch).toHaveBeenNthCalledWith(173 2,174 actions.paymentMethod.accept(paymentMethod)175 );176 expect(dispatch).toHaveBeenCalledTimes(2);177 });178 test('submitPaymentMethod thunk saves to storage on success', async () => {179 const payload = {180 type: 'paymentMethod',181 formValues: { paymentMethod }182 };183 await submitPaymentMethod(payload)(...thunkArgs);184 expect(mockSetItem).toHaveBeenCalledWith(185 'paymentMethod',186 paymentMethod187 );188 });189 test('submitPaymentMethod thunk throws if there is no guest cart', async () => {190 const payload = {191 type: 'paymentMethod',192 formValues: { paymentMethod }193 };194 getState.mockImplementationOnce(() => ({195 cart: {}196 }));197 await expect(198 submitPaymentMethod(payload)(...thunkArgs)199 ).rejects.toThrow('guestCartId');200 });201});202describe('submitShippingMethod', () => {203 const shippingMethod = {204 carrier_code: 'flatrate',205 carrier_title: 'Flat Rate',206 method_code: 'flatrate'207 };208 test('submitShippingMethod() returns a thunk', () => {209 expect(submitShippingMethod()).toBeInstanceOf(Function);210 });211 test('submitShippingMethod thunk returns undefined', async () => {212 const payload = {213 type: 'shippingMethod',214 formValues: { shippingMethod }215 };216 const result = await submitShippingMethod(payload)(...thunkArgs);217 expect(result).toBeUndefined();218 });219 test('submitShippingMethod thunk dispatches actions on success', async () => {220 const payload = {221 type: 'shippingMethod',222 formValues: { shippingMethod }223 };224 const response = true;225 request.mockResolvedValueOnce(response);226 await submitShippingMethod(payload)(...thunkArgs);227 expect(dispatch).toHaveBeenNthCalledWith(228 1,229 actions.shippingMethod.submit(payload)230 );231 // TODO: test fails but "Compared values have no visual difference."232 // expect(dispatch).toHaveBeenNthCalledWith(233 // 2,234 // cartActions.getCartDetails({ forceRefresh: true })235 // );236 expect(dispatch).toHaveBeenNthCalledWith(237 3,238 actions.shippingMethod.accept(shippingMethod)239 );240 expect(dispatch).toHaveBeenCalledTimes(3);241 });242 test('submitShippingMethod saves shipping method to local storage on success', async () => {243 const payload = {244 type: 'shippingMethod',245 formValues: { shippingMethod }246 };247 const response = true;248 request.mockResolvedValueOnce(response);249 await submitShippingMethod(payload)(...thunkArgs);250 expect(mockSetItem).toHaveBeenCalledWith(251 'shippingMethod',252 shippingMethod253 );254 expect(mockSetItem).toHaveBeenCalledTimes(1);255 });256 test('submitShippingMethod thunk dispatches actions on failure', async () => {257 const payload = {258 type: 'shippingMethod',259 formValues: { shippingMethod }260 };261 const error = new Error('ERROR');262 request.mockRejectedValueOnce(error);263 await submitShippingMethod(payload)(...thunkArgs);264 expect(dispatch).toHaveBeenNthCalledWith(265 1,266 actions.shippingMethod.submit(payload)267 );268 expect(dispatch).toHaveBeenNthCalledWith(269 2,270 actions.shippingMethod.reject(error)271 );272 expect(dispatch).toHaveBeenCalledTimes(2);273 });274 test('submitShippingMethod thunk throws if there is no guest cart', async () => {275 const payload = {276 type: 'shippingMethod',277 formValues: { shippingMethod }278 };279 getState.mockImplementationOnce(() => ({280 cart: {}281 }));282 await expect(283 submitShippingMethod(payload)(...thunkArgs)284 ).rejects.toThrow('guestCartId');285 });286});287describe('submitOrder', () => {288 test('submitOrder() returns a thunk', () => {289 expect(submitOrder()).toBeInstanceOf(Function);290 });291 test('submitOrder thunk returns undefined', async () => {292 const result = await submitOrder()(...thunkArgs);293 expect(result).toBeUndefined();294 });295 test('submitOrder thunk dispatches actions on success', async () => {296 const mockState = {297 cart: {298 details: {299 billing_address: address300 },301 guestCartId: 'GUEST_CART_ID'302 },303 directory: { countries }304 };305 getState.mockImplementationOnce(() => mockState);306 getState.mockImplementationOnce(() => mockState);307 // get address from storage.308 mockGetItem.mockImplementationOnce(() => address);309 // get payment method from storage.310 mockGetItem.mockImplementationOnce(() => ({ code: 'checkmo' }));311 const response = 1;312 request.mockResolvedValueOnce(response);313 await submitOrder()(...thunkArgs);314 expect(dispatch).toHaveBeenNthCalledWith(1, actions.order.submit());315 expect(dispatch).toHaveBeenNthCalledWith(316 2,317 checkoutReceiptActions.setOrderInformation({318 id: response,319 billing_address: address320 })321 );322 expect(dispatch).toHaveBeenNthCalledWith(323 3,324 actions.order.accept(response)325 );326 expect(dispatch).toHaveBeenCalledTimes(3);327 });328 test('submitOrder thunk clears local storage on success', async () => {329 const mockState = {330 cart: {331 details: {332 billing_address: address333 },334 guestCartId: 'GUEST_CART_ID'335 },336 directory: { countries }337 };338 getState.mockImplementationOnce(() => mockState);339 getState.mockImplementationOnce(() => mockState);340 // get address from storage.341 mockGetItem.mockImplementationOnce(() => address);342 // get payment method from storage.343 mockGetItem.mockImplementationOnce(() => ({ code: 'checkmo' }));344 const response = 1;345 request.mockResolvedValueOnce(response);346 await submitOrder()(...thunkArgs);347 expect(mockRemoveItem).toHaveBeenNthCalledWith(1, 'guestCartId');348 expect(mockRemoveItem).toHaveBeenNthCalledWith(2, 'address');349 expect(mockRemoveItem).toHaveBeenNthCalledWith(3, 'paymentMethod');350 expect(mockRemoveItem).toHaveBeenNthCalledWith(4, 'shippingMethod');351 expect(mockRemoveItem).toHaveBeenCalledTimes(4);352 });353 test('submitOrder thunk dispatches actions on failure', async () => {354 // get address from storage.355 mockGetItem.mockImplementationOnce(() => address);356 // get payment method from storage.357 mockGetItem.mockImplementationOnce(() => ({ code: 'checkmo' }));358 const error = new Error('ERROR');359 request.mockRejectedValueOnce(error);360 await submitOrder()(...thunkArgs);361 expect(dispatch).toHaveBeenNthCalledWith(1, actions.order.submit());362 expect(dispatch).toHaveBeenNthCalledWith(363 2,364 actions.order.reject(error)365 );366 expect(dispatch).toHaveBeenCalledTimes(2);367 });368 test('submitOrder thunk throws if there is no guest cart', async () => {369 getState.mockImplementationOnce(() => ({370 cart: {}371 }));372 await expect(submitOrder()(...thunkArgs)).rejects.toThrow(373 'guestCartId'374 );375 });...

Full Screen

Full Screen

submit.py

Source:submit.py Github

copy

Full Screen

...257 raise RuntimeError("Invalid task name. Probable reason: unacceptable characters in your submit_config.run_desc. Task name must be accepted by the following regex: " + docker_valid_name_regex + ", got " + submit_config.task_name)258 # Farm specific preparations for a submit259 farm.finalize_submit_config(submit_config, host_run_dir)260 _populate_run_dir(submit_config, host_run_dir)...

Full Screen

Full Screen

hide_submit.js

Source:hide_submit.js Github

copy

Full Screen

...48 return true;49 });50 }51 // Bind to form submit.52 $('form', context).submit(function (e) {53 var $inp;54 if (!e.isPropagationStopped()) {55 if (Drupal.settings.hide_submit.hide_submit_method === 'disable') {56 $('input.form-submit, button.form-submit', $form).attr('disabled', 'disabled').each(function (i) {57 var $button = $(this);58 if (Drupal.settings.hide_submit.hide_submit_css) {59 $button.addClass(Drupal.settings.hide_submit.hide_submit_css);60 }61 if (Drupal.settings.hide_submit.hide_submit_abtext) {62 $button.val($button.val() + ' ' + Drupal.settings.hide_submit.hide_submit_abtext);63 }64 $inp = $button;65 });66 if ($inp && Drupal.settings.hide_submit.hide_submit_atext) {...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful