def send_push_course_update(course_key_string, course_subscription_id, course_display_name): """ Sends a push notification for a course update, given the course's subscription_id and display_name. """ if settings.PARSE_KEYS: try: register(settings.PARSE_KEYS["APPLICATION_ID"], settings.PARSE_KEYS["REST_API_KEY"]) push_payload = { "action": "course.announcement", "notification-id": unicode(uuid4()), "course-id": course_key_string, "course-name": course_display_name, } push_channels = [course_subscription_id] # Push to all Android devices Push.alert(data=push_payload, channels={"$in": push_channels}, where={"deviceType": "android"}) # Push to all iOS devices # With additional payload so that # 1. The push is displayed automatically # 2. The app gets it even in the background. # See http://stackoverflow.com/questions/19239737/silent-push-notification-in-ios-7-does-not-work push_payload.update({"alert": "", "content-available": 1}) Push.alert(data=push_payload, channels={"$in": push_channels}, where={"deviceType": "ios"}) except ParseError as error: log_exception(error.message)
def send_push_course_update(course_key_string, course_subscription_id, course_display_name): """ Sends a push notification for a course update, given the course's subscription_id and display_name. """ if settings.PARSE_KEYS: try: register( settings.PARSE_KEYS["APPLICATION_ID"], settings.PARSE_KEYS["REST_API_KEY"], ) Push.alert( data={ "course-id": course_key_string, "action": "course.announcement", "action-loc-key": "VIEW_BUTTON", "loc-key": "COURSE_ANNOUNCEMENT_NOTIFICATION_BODY", "loc-args": [course_display_name], "title-loc-key": "COURSE_ANNOUNCEMENT_NOTIFICATION_TITLE", "title-loc-args": [], }, channels=[course_subscription_id], ) except ParseError as error: log_exception(error.message)
def prepareCounterTimerSimulator(self): """Prepare the Counter Timer Simulator local variables and registers in the Database""" if not self.needsCounterTimerSimulator(): return self.ctsim_ds_instance = self.common_ds_instance self.ctsim_ctrl_dev_name = self.username + "/simctctrl/test" self.ctsim_process = None self.ctsim_start_time = -1 self.ctsim_stopt_time = -1 self.ctsim_exec = None # Make sure the python device server code is reachable try: f, self.ctsim_exec, desc = imp.find_module('SimuCoTiCtrl') f.close() f, path, desc = imp.find_module('SimuCounter') f.close() except ImportError as e: self.assert_(False, e) logging.log_exception(e) # Include the name and path attributes in output. logging.log('error.name: {e.name}') logging.log('error.path: {e.path}') self.ctsim_exec = self.ctsim_exec # Cleanup the database self.deleteCounterTimerSimulatorFromDB() # Create a new instance in database self.createCounterTimerSimulatorInDB()
def env_validator(env): # Check that the env exist if not isinstance(env, str): raise Exception("ADE environment variable is missing") logging.log_exception(error) if len(env) < 2: raise Exception("ADE environment variable is not correct") logging.log_exception(exception) else: pass
def send_push_course_update(course_key_string, course_subscription_id, course_display_name): """ Sends a push notification for a course update, given the course's subscription_id and display_name. """ if settings.PARSE_KEYS: try: register( settings.PARSE_KEYS["APPLICATION_ID"], settings.PARSE_KEYS["REST_API_KEY"], ) push_payload = { "action": "course.announcement", "notification-id": unicode(uuid4()), "course-id": course_key_string, "course-name": course_display_name, } push_channels = [course_subscription_id] # Push to all Android devices Push.alert( data=push_payload, channels={"$in": push_channels}, where={"deviceType": "android"}, ) # Push to all iOS devices # With additional payload so that # 1. The push is displayed automatically # 2. The app gets it even in the background. # See http://stackoverflow.com/questions/19239737/silent-push-notification-in-ios-7-does-not-work push_payload.update({ "alert": "", "content-available": 1 }) Push.alert( data=push_payload, channels={"$in": push_channels}, where={"deviceType": "ios"}, ) except ParseError as error: log_exception(text_type(error))
def testbtnregulasi(self): try: driver = self.driver driver.find_element_by_xpath("//*[@id='login']/img").click() userfb = driver.find_element_by_id('email') userfb.send_keys('*****@*****.**') passfb = driver.find_element_by_id('pass') passfb.send_keys('garenawebdev') btnfb = driver.find_element_by_xpath('//*[@id="loginbutton"]').click() time.sleep(5) btnRegulasi = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[4]/div[1]/a').click() time.sleep(5) except AssertionError as error: logging.log_exception(error) finally: self.driver.quit()
def testInValidFormat(self): try: driver = self.driver # driver.execute_script("$('#login img').find('img[src$='assets/img/icon_web/icon_bigwhitefb.png'].click()") # driver.execute_script("//*[@id='login']/img[@src='assets/img/icon_web/icon_bigwhitefb.png'") driver.find_element_by_xpath("//*[@id='login']/img").click() userfb = driver.find_element_by_id('email') userfb.send_keys('*****@*****.**') passfb = driver.find_element_by_id('pass') passfb.send_keys('garenawebdev') btnfb = driver.find_element_by_xpath('//*[@id="loginbutton"]').click() time.sleep(5) nama = driver.find_element_by_name('team_name') nama.send_keys('testingdev') guild_id = driver.find_element_by_name('guild_id') guild_id.send_keys('869685038') nama_guild = driver.find_element_by_name('guild_name') nama_guild.send_keys('testerdevweb') nama_kapten = driver.find_element_by_name('nama_lengkap_1') nama_kapten.send_keys('developertester') no_identitas_kapten = driver.find_element_by_name('no_id_1') no_identitas_kapten.send_keys('3216054910980010') telp = driver.find_element_by_name('no_telp') telp.send_keys('087887123010') email = driver.find_element_by_name('email') email.send_keys('*****@*****.**') discord_id = driver.find_element_by_name('discord_username') discord_id.send_keys('acc_1234') domisili = driver.find_element_by_name('domisili_1') domisili.send_keys('jakarta') anggota1 = driver.find_element_by_name('nama_lengkap_2') anggota1.send_keys('testersatu') no_identitas_anggota1 = driver.find_element_by_name('no_id_2') no_identitas_anggota1.send_keys('3217098709760098') domisili_anggota1 = driver.find_element_by_name('domisili_2') domisili_anggota1.send_keys('bekasi') no_id_anggota1 = driver.find_element_by_name('account_id_2') no_id_anggota1.send_keys('123489796') validate_anggota1 = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[2]/div[3]/div/div/div[4]/div/div/div/button').click() time.sleep(1) popup = driver.find_element_by_xpath('//*[@id="errorModal"]/div/div/div/button/img').click() time.sleep(1) anggota2 = driver.find_element_by_name('nama_lengkap_3') if anggota2 is None: print("eror") else: anggota2.send_keys('hahaetestng') no_identitas_anggota2 = driver.find_element_by_name("no_id_3") no_identitas_anggota2.send_keys('3216785938754097') time.sleep(5) domisili_anggota2 = driver.find_element_by_name("domisili_3").send_keys("Lampung Selatan") time.sleep(5) no_id_anggota2 = driver.find_element_by_name('account_id_3') no_id_anggota2.send_keys("04043745922") validate_anggota2 = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[2]/div[4]/div/div/div[4]/div/div/div/button').click() time.sleep(5) pop2 = driver.find_element_by_xpath('//*[@id="errorModal"]/div/div/div/button/img').click() time.sleep(5) anggota3 = driver.find_element_by_name('nama_lengkap_4') anggota3.send_keys('testingtigaa') no_identitas_anggota3 = driver.find_element_by_name('no_id_4') no_identitas_anggota3.send_keys('321806576196643') domisili_anggota3 = driver.find_element_by_name("domisili_4").send_keys("Banjarmasin") time.sleep(1) no_id_anggota3 = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[2]/div[5]/div/div/div[4]/div/div/input') no_id_anggota3.send_keys('097869608') time.sleep(10) validate_anggota3 = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[2]/div[5]/div/div/div[4]/div/div/div/button').click() time.sleep(5) pop3 = driver.find_element_by_xpath('//*[@id="errorModal"]/div/div/div/button/img').click() time.sleep(1) cadangan = driver.find_element_by_name('nama_lengkap_5') cadangan.send_keys('testerkeempat') time.sleep(1) no_identitas_cadangan = driver.find_element_by_name('no_id_5') no_identitas_cadangan.send_keys('34856993') time.sleep(1) domisili_cadangan = driver.find_element_by_name('domisili_5') domisili_cadangan.send_keys('banten') time.sleep(1) no_id_cadangan = driver.find_element_by_name('account_id_5') no_id_cadangan.send_keys('3740573027') time.sleep(1) validate_cadangan = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[2]/div[6]/div/div/div[4]/div/div/div/button').click() time.sleep(1) popcad = driver.find_element_by_xpath('//*[@id="errorModal"]/div/div/div/button/img').click() time.sleep(1) checkboxes = driver.find_element_by_xpath('//*[@id="understanding"]').click() time.sleep(5) btnKirim = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[4]/div[2]/button').click() time.sleep(2) pop4 = driver.find_element_by_xpath('//*[@id="errorModal"]/div/div/div/button/img').click() time.sleep(3) logout = driver.find_element_by_xpath('//*[@id="daftar"]/form/div[1]/div/div/a').click() time.sleep(5) def is_element_present(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException as e: return False return True def is_alert_present(self): try: self.driver.switch_to_alert() except NoAlertPresentException as e: return False return True def close_alert_and_get_its_text(self): try: alert = self.driver.switch_to_alert() alert_text = alert.text if self.accept_next_alert: alert.accept() else: alert.dismiss() return alert_text finally: self.accept_next_alert = True except AssertionError as error : logging.log_exception(error) finally: self.driver.quit()
# A Node has nodes and parameters ossia.Node.get_nodes = get_nodes ossia.Node.get_parameters = get_parameters ossia.Node.init = init # A Parameter can be reset to its default_value ossia.Parameter.reset = reset #ossia.Parameter.description = ossia.Node.description BoundingMode = ossia.BoundingMode AccessMode = ossia.AccessMode ValueType = ossia.ValueType LocalDevice = ossia.LocalDevice ValueType = ossia.ValueType Node = ossia.Node Parameter = ossia.Parameter MinuitDevice = ossia.MinuitDevice MidiDevice = ossia.MidiDevice OSCQueryDevice = ossia.OSCQueryDevice MessageQueue = ossia.MessageQueue GlobalMessageQueue = ossia.GlobalMessageQueue except ImportError as error: logging.info("Can't import module 'ossia_python'") # Output expected ImportErrors. logging.exception(error) # Include the name and path attributes in output. except Exception as exception: # Output unexpected Exceptions. logging.log_exception(exception, False)