How to use unsubscribe method in localstack

Best Python code snippet using localstack_python

queue.py

Source: queue.py Github

copy

Full Screen

...274 # for test275 frappe.local.flags.signed_query_string = query_string276 return get_url(unsubscribe_method + "?" + get_signed_params(params))277@frappe.whitelist(allow_guest=True)278def unsubscribe(doctype, name, email):279 # unsubsribe from comments and communications280 if not verify_request():281 return282 try:283 frappe.get_doc({284 "doctype": "Email Unsubscribe",285 "email": email,286 "reference_doctype": doctype,287 "reference_name": name288 }).insert(ignore_permissions=True)289 except frappe.DuplicateEntryError:290 frappe.db.rollback()291 else:292 frappe.db.commit()...

Full Screen

Full Screen

modules_unsubscribe.py

Source: modules_unsubscribe.py Github

copy

Full Screen

1# Copyright 2014 Google Inc. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http:/​/​www.apache.org/​licenses/​LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS-IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Tests for the module to support users unsubscribing from notifications."""15__author__ = 'John Orr (jorr@google.com)'16import urlparse17from common import utils18from controllers import sites19from modules.unsubscribe import unsubscribe20from tests.functional import actions21from google.appengine.ext import db22class BaseUnsubscribeTests(actions.TestBase):23 def assertUnsubscribed(self, email, namespace):24 with utils.Namespace(namespace):25 self.assertTrue(unsubscribe.has_unsubscribed(email))26 def assertSubscribed(self, email, namespace):27 with utils.Namespace(namespace):28 self.assertFalse(unsubscribe.has_unsubscribed(email))29class GetUnsubscribeUrlTests(actions.TestBase):30 def test_get_unsubscribe_url(self):31 handler = actions.MockHandler(32 app_context=actions.MockAppContext(slug='new_course'))33 url = unsubscribe.get_unsubscribe_url(handler, 'test@example.com')34 parsed_url = urlparse.urlparse(url)35 self.assertEquals('http', parsed_url.scheme)36 self.assertEquals('mycourse.appspot.com', parsed_url.netloc)37 self.assertEquals('/​new_course/​modules/​unsubscribe', parsed_url.path)38 query_dict = urlparse.parse_qs(parsed_url.query)39 self.assertEquals(['test@example.com'], query_dict['email'])40 self.assertRegexpMatches(query_dict['s'][0], r'[0-9a-f]{32}')41class SubscribeAndUnsubscribeTests(BaseUnsubscribeTests):42 EMAIL = 'test@example.com'43 def setUp(self):44 super(SubscribeAndUnsubscribeTests, self).setUp()45 self.namespace = 'namespace'46 def test_subscription_state_never_set(self):47 with utils.Namespace(self.namespace):48 self.assertSubscribed(self.EMAIL, self.namespace)49 def test_set_subscription_state(self):50 with utils.Namespace(self.namespace):51 unsubscribe.set_subscribed(self.EMAIL, False)52 self.assertUnsubscribed(self.EMAIL, self.namespace)53 def test_set_then_unset_subscription_state(self):54 with utils.Namespace(self.namespace):55 self.assertSubscribed(self.EMAIL, self.namespace)56 unsubscribe.set_subscribed(self.EMAIL, True)57 self.assertSubscribed(self.EMAIL, self.namespace)58 unsubscribe.set_subscribed(self.EMAIL, False)59 self.assertUnsubscribed(self.EMAIL, self.namespace)60 def test_subscription_state_entity_must_have_key_name(self):61 with self.assertRaises(db.BadValueError):62 unsubscribe.SubscriptionStateEntity()63 with self.assertRaises(db.BadValueError):64 unsubscribe.SubscriptionStateEntity(id='23')65class UnsubscribeHandlerTests(BaseUnsubscribeTests):66 def setUp(self):67 super(UnsubscribeHandlerTests, self).setUp()68 self.base = '/​a'69 self.namespace = 'ns_a'70 sites.setup_courses('course:/​a::ns_a')71 self.app_context = actions.MockAppContext(72 namespace=self.namespace, slug='a')73 self.handler = actions.MockHandler(74 base_href='http:/​/​localhost/​',75 app_context=self.app_context)76 self.email = 'test@example.com'77 actions.login(self.email, is_admin=True)78 def test_unsubscribe_and_resubscribe(self):79 self.assertSubscribed(self.email, self.namespace)80 unsubscribe_url = unsubscribe.get_unsubscribe_url(81 self.handler, self.email)82 response = self.get(unsubscribe_url)83 # Confirm the user has unsubscribed84 self.assertUnsubscribed(self.email, self.namespace)85 # Confirm the page content of the response86 root = self.parse_html_string(response.body).find(87 './​/​*[@id="unsubscribe-message"]')88 confirm_elt = root.find('./​p[1]')89 self.assertTrue('has been unsubscribed' in confirm_elt.text)90 email_elt = root.find('./​/​div[1]')91 self.assertEquals(self.email, email_elt.text.strip())92 resubscribe_url = root.find('./​/​div[2]/​button').attrib[93 'data-resubscribe-url']94 response = self.get(resubscribe_url)95 # Confirm the user has now resubscribed96 self.assertSubscribed(self.email, self.namespace)97 # Confirm the page content of the response98 root = self.parse_html_string(response.body).find(99 './​/​*[@id="resubscribe-message"]')100 confirm_elt = root.find('./​p[1]')101 self.assertTrue('has been subscribed' in confirm_elt.text)102 email_elt = root.find('./​/​div[1]')103 self.assertEquals(self.email, email_elt.text.strip())104 def test_bad_signature_rejected_with_401(self):105 response = self.get(106 'modules/​unsubscribe'107 '?email=test%40example.com&s=bad_signature',108 expect_errors=True)109 self.assertEquals(401, response.status_code)110 def test_unsubscribe_request_with_no_email_prompts_for_login(self):111 actions.logout()112 response = self.get('modules/​unsubscribe')113 self.assertEquals(302, response.status_int)114 self.assertEquals(115 'https:/​/​www.google.com/​accounts/​Login'116 '?continue=http%3A/​/​localhost/​a/​modules/​unsubscribe',117 response.headers['Location'])118 def test_unsubscribe_with_no_email_and_in_session(self):119 response = self.get('modules/​unsubscribe')120 # Confirm the user has unsubscribed121 self.assertUnsubscribed(self.email, self.namespace)122 # Confirm the page content of the response123 root = self.parse_html_string(response.body).find(124 './​/​*[@id="unsubscribe-message"]')125 confirm_elt = root.find('./​p[1]')126 self.assertTrue('has been unsubscribed' in confirm_elt.text)127 email_elt = root.find('./​/​div[1]')128 self.assertEquals(self.email, email_elt.text.strip())129 resubscribe_url = root.find('./​/​div[2]/​button').attrib[130 'data-resubscribe-url']131 response = self.get(resubscribe_url)132 # Confirm the user has now resubscribed...

Full Screen

Full Screen

bus.unit.js

Source: bus.unit.js Github

copy

Full Screen

...70 }71 }72 };73 var bus = new Bus({node: node});74 bus.unsubscribe('dbtest', 'a', 'b', 'c');75 bus.unsubscribe('test', 'a', 'b', 'c');76 unsubscribeService.callCount.should.equal(1);77 unsubscribeDb.callCount.should.equal(1);78 unsubscribeDb.args[0][0].should.equal(bus);79 unsubscribeDb.args[0][1].should.equal('a');80 unsubscribeDb.args[0][2].should.equal('b');81 unsubscribeDb.args[0][3].should.equal('c');82 unsubscribeService.args[0][0].should.equal(bus);83 unsubscribeService.args[0][1].should.equal('a');84 unsubscribeService.args[0][2].should.equal('b');85 unsubscribeService.args[0][3].should.equal('c');86 });87 });88 describe('#close', function() {89 it('will unsubscribe from all events', function() {...

Full Screen

Full Screen

Unsubscribe.js

Source: Unsubscribe.js Github

copy

Full Screen

...80 /​**81 * Now we unsubscribe node 282 * It should work.83 */​84 this.unsubscribe(2,1,true);85 86 /​**87 * unsubscribe node 3,88 * it should fail since 3 is a forwarder to 4,589 */​90 this.unsubscribe(3,1,false);91 92 93 for(var idx=1; idx <= this.getNodeCount(); idx++) { 94 slonArray[idx-1].stop();95 this.coordinator.join(slonArray[idx-1]);96 }97 this.coordinator.log("Unsubscribe.prototype.runTest - complete"); 98}99Unsubscribe.prototype.unsubscribe=function(node_id,set_id,expect_success) {100 this.coordinator.log("Unsubscribe.prototype.unsubscribe - begin"); 101 var slonikPreamble = this.getSlonikPreamble();102 var slonikScript = 'echo \'Unsubscribe.prototype.unsubscribe\';\n';103 slonikScript +='unsubscribe set(id=' + set_id + ',receiver=' + node_id + ');\n';104 var slonik = this.coordinator.createSlonik('unsubscribe ' , slonikPreamble,slonikScript);...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation &#8211; Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

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 localstack 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