mirror of https://github.com/zulip/zulip.git
pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
This commit is contained in:
parent
fae59502ab
commit
94b28e0afb
|
@ -43,7 +43,7 @@ def do_send_message(client, message_data):
|
||||||
|
|
||||||
if message_data['type'] == 'stream':
|
if message_data['type'] == 'stream':
|
||||||
log.info('Sending message to stream "%s", subject "%s"... ' %
|
log.info('Sending message to stream "%s", subject "%s"... ' %
|
||||||
(message_data['to'], message_data['subject']))
|
(message_data['to'], message_data['subject']))
|
||||||
else:
|
else:
|
||||||
log.info('Sending message to %s... ' % message_data['to'])
|
log.info('Sending message to %s... ' % message_data['to'])
|
||||||
response = client.send_message(message_data)
|
response = client.send_message(message_data)
|
||||||
|
|
|
@ -74,14 +74,14 @@ parser = optparse.OptionParser(r"""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
parser.add_option('--twitter-id',
|
parser.add_option('--twitter-id',
|
||||||
help='Twitter username to poll for new tweets from"',
|
help='Twitter username to poll for new tweets from"',
|
||||||
metavar='URL')
|
metavar='URL')
|
||||||
parser.add_option('--stream',
|
parser.add_option('--stream',
|
||||||
help='Default zulip stream to write tweets to')
|
help='Default zulip stream to write tweets to')
|
||||||
parser.add_option('--limit-tweets',
|
parser.add_option('--limit-tweets',
|
||||||
default=15,
|
default=15,
|
||||||
type='int',
|
type='int',
|
||||||
help='Maximum number of tweets to push at once')
|
help='Maximum number of tweets to push at once')
|
||||||
|
|
||||||
parser.add_option_group(zulip.generate_option_group(parser))
|
parser.add_option_group(zulip.generate_option_group(parser))
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
|
@ -313,7 +313,7 @@ class Client(object):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
if not query_state["had_error_retry"]:
|
if not query_state["had_error_retry"]:
|
||||||
sys.stdout.write("zulip API(%s): connection error%s -- retrying." %
|
sys.stdout.write("zulip API(%s): connection error%s -- retrying." %
|
||||||
(url.split(API_VERSTRING, 2)[0], error_string,))
|
(url.split(API_VERSTRING, 2)[0], error_string,))
|
||||||
query_state["had_error_retry"] = True
|
query_state["had_error_retry"] = True
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(".")
|
sys.stdout.write(".")
|
||||||
|
|
|
@ -329,11 +329,11 @@ for key in all_keys:
|
||||||
if key in zhkeys:
|
if key in zhkeys:
|
||||||
(stream, test) = zhkeys[key]
|
(stream, test) = zhkeys[key]
|
||||||
logger.warning("%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s" %
|
logger.warning("%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s" %
|
||||||
(key, z_key_counts[key], h_key_counts[key], test, stream))
|
(key, z_key_counts[key], h_key_counts[key], test, stream))
|
||||||
if key in hzkeys:
|
if key in hzkeys:
|
||||||
(stream, test) = hzkeys[key]
|
(stream, test) = hzkeys[key]
|
||||||
logger.warning("%10s: z got %s. h got %s. Sent via Zulip(%s): class %s" %
|
logger.warning("%10s: z got %s. h got %s. Sent via Zulip(%s): class %s" %
|
||||||
(key, z_key_counts[key], h_key_counts[key], test, stream))
|
(key, z_key_counts[key], h_key_counts[key], test, stream))
|
||||||
logger.error("")
|
logger.error("")
|
||||||
logger.error("Summary of specific problems:")
|
logger.error("Summary of specific problems:")
|
||||||
|
|
||||||
|
|
|
@ -34,17 +34,17 @@ parser = optparse.OptionParser(r"""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
parser.add_option('--calendar',
|
parser.add_option('--calendar',
|
||||||
dest='calendar',
|
dest='calendar',
|
||||||
action='store',
|
action='store',
|
||||||
help='Google Calendar XML "Private Address"',
|
help='Google Calendar XML "Private Address"',
|
||||||
metavar='URL')
|
metavar='URL')
|
||||||
parser.add_option('--interval',
|
parser.add_option('--interval',
|
||||||
dest='interval',
|
dest='interval',
|
||||||
default=10,
|
default=10,
|
||||||
type=int,
|
type=int,
|
||||||
action='store',
|
action='store',
|
||||||
help='Minutes before event for reminder [default: 10]',
|
help='Minutes before event for reminder [default: 10]',
|
||||||
metavar='MINUTES')
|
metavar='MINUTES')
|
||||||
parser.add_option_group(zulip.generate_option_group(parser))
|
parser.add_option_group(zulip.generate_option_group(parser))
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
@ -65,7 +65,7 @@ def get_calendar_url():
|
||||||
parser.error('The --calendar URL should be the XML "Private Address" ' +
|
parser.error('The --calendar URL should be the XML "Private Address" ' +
|
||||||
'from your calendar settings')
|
'from your calendar settings')
|
||||||
return urllib.parse.urlunparse((parts.scheme, parts.netloc, pat[0] + '/full',
|
return urllib.parse.urlunparse((parts.scheme, parts.netloc, pat[0] + '/full',
|
||||||
'', 'futureevents=true&orderby=startdate', ''))
|
'', 'futureevents=true&orderby=startdate', ''))
|
||||||
|
|
||||||
calendar_url = get_calendar_url()
|
calendar_url = get_calendar_url()
|
||||||
|
|
||||||
|
|
|
@ -322,28 +322,28 @@ def config_error(msg):
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = optparse.OptionParser(epilog=
|
parser = optparse.OptionParser(
|
||||||
'''Most general and Jabber configuration options may also be specified in the
|
epilog='''Most general and Jabber configuration options may also be specified in the
|
||||||
zulip configuration file under the jabber_mirror section (exceptions are noted
|
zulip configuration file under the jabber_mirror section (exceptions are noted
|
||||||
in their help sections). Keys have the same name as options with hyphens
|
in their help sections). Keys have the same name as options with hyphens
|
||||||
replaced with underscores. Zulip configuration options go in the api section,
|
replaced with underscores. Zulip configuration options go in the api section,
|
||||||
as normal.'''.replace("\n", " ")
|
as normal.'''.replace("\n", " ")
|
||||||
)
|
)
|
||||||
parser.add_option('--mode',
|
parser.add_option(
|
||||||
default=None,
|
'--mode',
|
||||||
action='store',
|
default=None,
|
||||||
help=
|
action='store',
|
||||||
'''Which mode to run in. Valid options are "personal" and "public". In
|
help='''Which mode to run in. Valid options are "personal" and "public". In
|
||||||
"personal" mode, the mirror uses an individual users' credentials and mirrors
|
"personal" mode, the mirror uses an individual users' credentials and mirrors
|
||||||
all messages they send on Zulip to Jabber and all private Jabber messages to
|
all messages they send on Zulip to Jabber and all private Jabber messages to
|
||||||
Zulip. In "public" mode, the mirror uses the credentials for a dedicated mirror
|
Zulip. In "public" mode, the mirror uses the credentials for a dedicated mirror
|
||||||
user and mirrors messages sent to Jabber rooms to Zulip. Defaults to
|
user and mirrors messages sent to Jabber rooms to Zulip. Defaults to
|
||||||
"personal"'''.replace("\n", " "))
|
"personal"'''.replace("\n", " "))
|
||||||
parser.add_option('--zulip-email-suffix',
|
parser.add_option(
|
||||||
default=None,
|
'--zulip-email-suffix',
|
||||||
action='store',
|
default=None,
|
||||||
help=
|
action='store',
|
||||||
'''Add the specified suffix to the local part of email addresses constructed
|
help='''Add the specified suffix to the local part of email addresses constructed
|
||||||
from JIDs and nicks before sending requests to the Zulip server, and remove the
|
from JIDs and nicks before sending requests to the Zulip server, and remove the
|
||||||
suffix before sending requests to the Jabber server. For example, specifying
|
suffix before sending requests to the Jabber server. For example, specifying
|
||||||
"+foo" will cause messages that are sent to the "bar" room by nickname "qux" to
|
"+foo" will cause messages that are sent to the "bar" room by nickname "qux" to
|
||||||
|
@ -357,14 +357,15 @@ option does not affect login credentials.'''.replace("\n", " "))
|
||||||
default=logging.INFO)
|
default=logging.INFO)
|
||||||
|
|
||||||
jabber_group = optparse.OptionGroup(parser, "Jabber configuration")
|
jabber_group = optparse.OptionGroup(parser, "Jabber configuration")
|
||||||
jabber_group.add_option('--jid',
|
jabber_group.add_option(
|
||||||
default=None,
|
'--jid',
|
||||||
action='store',
|
default=None,
|
||||||
help="Your Jabber JID. If a resource is specified, "
|
action='store',
|
||||||
+ "it will be used as the nickname when joining MUCs. "
|
help="Your Jabber JID. If a resource is specified, "
|
||||||
+ "Specifying the nickname is mostly useful if you want "
|
+ "it will be used as the nickname when joining MUCs. "
|
||||||
+ "to run the public mirror from a regular user instead of "
|
+ "Specifying the nickname is mostly useful if you want "
|
||||||
+ "from a dedicated account.")
|
+ "to run the public mirror from a regular user instead of "
|
||||||
|
+ "from a dedicated account.")
|
||||||
jabber_group.add_option('--jabber-password',
|
jabber_group.add_option('--jabber-password',
|
||||||
default=None,
|
default=None,
|
||||||
action='store',
|
action='store',
|
||||||
|
@ -380,12 +381,12 @@ option does not affect login credentials.'''.replace("\n", " "))
|
||||||
jabber_group.add_option('--jabber-server-address',
|
jabber_group.add_option('--jabber-server-address',
|
||||||
default=None,
|
default=None,
|
||||||
action='store',
|
action='store',
|
||||||
help="The hostname of your Jabber server. This is only needed if "
|
help="The hostname of your Jabber server. This is only needed if "
|
||||||
"your server is missing SRV records")
|
"your server is missing SRV records")
|
||||||
jabber_group.add_option('--jabber-server-port',
|
jabber_group.add_option('--jabber-server-port',
|
||||||
default='5222',
|
default='5222',
|
||||||
action='store',
|
action='store',
|
||||||
help="The port of your Jabber server. This is only needed if "
|
help="The port of your Jabber server. This is only needed if "
|
||||||
"your server is missing SRV records")
|
"your server is missing SRV records")
|
||||||
|
|
||||||
parser.add_option_group(jabber_group)
|
parser.add_option_group(jabber_group)
|
||||||
|
|
|
@ -631,7 +631,7 @@ Feedback button or at support@zulipchat.com."""
|
||||||
|
|
||||||
wrapper = textwrap.TextWrapper(break_long_words=False, break_on_hyphens=False)
|
wrapper = textwrap.TextWrapper(break_long_words=False, break_on_hyphens=False)
|
||||||
wrapped_content = "\n".join("\n".join(wrapper.wrap(line))
|
wrapped_content = "\n".join("\n".join(wrapper.wrap(line))
|
||||||
for line in message["content"].replace("@", "@@").split("\n"))
|
for line in message["content"].replace("@", "@@").split("\n"))
|
||||||
|
|
||||||
zwrite_args = ["zwrite", "-n", "-s", message["sender_full_name"],
|
zwrite_args = ["zwrite", "-n", "-s", message["sender_full_name"],
|
||||||
"-F", "Zephyr error: See http://zephyr.1ts.org/wiki/df",
|
"-F", "Zephyr error: See http://zephyr.1ts.org/wiki/df",
|
||||||
|
|
|
@ -89,11 +89,11 @@ def run():
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage=usage)
|
parser = optparse.OptionParser(usage=usage)
|
||||||
parser.add_option('--quiet', '-q',
|
parser.add_option('--quiet', '-q',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Turn off logging output.')
|
help='Turn off logging output.')
|
||||||
parser.add_option('--config-file',
|
parser.add_option('--config-file',
|
||||||
action='store',
|
action='store',
|
||||||
help='(alternate config file to ~/.zuliprc)')
|
help='(alternate config file to ~/.zuliprc)')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
|
|
|
@ -22,5 +22,5 @@ for i in range(1, 100):
|
||||||
|
|
||||||
# Convert to PNG
|
# Convert to PNG
|
||||||
subprocess.check_call(['inkscape', '--without-gui', '--export-area-page',
|
subprocess.check_call(['inkscape', '--without-gui', '--export-area-page',
|
||||||
'--export-png=../../static/images/favicon/favicon-%d.png' % (i,),
|
'--export-png=../../static/images/favicon/favicon-%d.png' % (i,),
|
||||||
'tmp.svg'])
|
'tmp.svg'])
|
||||||
|
|
|
@ -19,8 +19,8 @@ def check_our_files():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-m', '--modified',
|
parser.add_argument('-m', '--modified',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='only check modified files')
|
help='only check modified files')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
by_lang = cast(
|
by_lang = cast(
|
||||||
|
|
|
@ -20,14 +20,14 @@ STATIC_PATH = 'static/'
|
||||||
def get_templates():
|
def get_templates():
|
||||||
# type: () -> List[str]
|
# type: () -> List[str]
|
||||||
return (glob.glob(os.path.join(STATIC_PATH, 'templates/*.handlebars')) +
|
return (glob.glob(os.path.join(STATIC_PATH, 'templates/*.handlebars')) +
|
||||||
glob.glob(os.path.join(STATIC_PATH, 'templates/settings/*.handlebars')))
|
glob.glob(os.path.join(STATIC_PATH, 'templates/settings/*.handlebars')))
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
subprocess.check_call(['node', 'node_modules/.bin/handlebars']
|
subprocess.check_call(['node', 'node_modules/.bin/handlebars']
|
||||||
+ get_templates()
|
+ get_templates()
|
||||||
+ ['--output', os.path.join(STATIC_PATH, 'templates/compiled.js'),
|
+ ['--output', os.path.join(STATIC_PATH, 'templates/compiled.js'),
|
||||||
'--known', 'if,unless,each,with'])
|
'--known', 'if,unless,each,with'])
|
||||||
|
|
||||||
def run_forever():
|
def run_forever():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
|
|
@ -33,8 +33,8 @@ def process_files():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=description)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument('-v', '--verbose',
|
parser.add_argument('-v', '--verbose',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='show where calls are')
|
help='show where calls are')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
fns = glob.glob('static/js/*.js')
|
fns = glob.glob('static/js/*.js')
|
||||||
|
|
|
@ -55,12 +55,12 @@ def check_our_files():
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage=USAGE)
|
parser = optparse.OptionParser(usage=USAGE)
|
||||||
parser.add_option('--modified', '-m',
|
parser.add_option('--modified', '-m',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='Only check modified files')
|
help='Only check modified files')
|
||||||
parser.add_option('--no-filter', '-a',
|
parser.add_option('--no-filter', '-a',
|
||||||
dest='show_all',
|
dest='show_all',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='Show all HTML files (no filtering)')
|
help='Show all HTML files (no filtering)')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.show_all:
|
if options.show_all:
|
||||||
|
|
|
@ -219,7 +219,7 @@ def validate(fn=None, text=None, check_indent=True):
|
||||||
def is_special_html_tag(s, tag):
|
def is_special_html_tag(s, tag):
|
||||||
# type: (str, str) -> bool
|
# type: (str, str) -> bool
|
||||||
return (s.startswith('<!--') or
|
return (s.startswith('<!--') or
|
||||||
tag in ['link', 'meta', '!DOCTYPE'])
|
tag in ['link', 'meta', '!DOCTYPE'])
|
||||||
|
|
||||||
def is_django_block_tag(tag):
|
def is_django_block_tag(tag):
|
||||||
# type: (str) -> bool
|
# type: (str) -> bool
|
||||||
|
|
|
@ -55,9 +55,9 @@ def check_pyflakes(options, by_lang):
|
||||||
return False
|
return False
|
||||||
failed = False
|
failed = False
|
||||||
pyflakes = subprocess.Popen(['pyflakes'] + by_lang['py'],
|
pyflakes = subprocess.Popen(['pyflakes'] + by_lang['py'],
|
||||||
stdout = subprocess.PIPE,
|
stdout = subprocess.PIPE,
|
||||||
stderr = subprocess.PIPE,
|
stderr = subprocess.PIPE,
|
||||||
universal_newlines = True)
|
universal_newlines = True)
|
||||||
|
|
||||||
# pyflakes writes some output (like syntax errors) to stderr. :/
|
# pyflakes writes some output (like syntax errors) to stderr. :/
|
||||||
for pipe in (pyflakes.stdout, pyflakes.stderr):
|
for pipe in (pyflakes.stdout, pyflakes.stderr):
|
||||||
|
@ -82,7 +82,7 @@ def check_pep8(files):
|
||||||
# type: (List[str]) -> bool
|
# type: (List[str]) -> bool
|
||||||
failed = False
|
failed = False
|
||||||
ignored_rules = [
|
ignored_rules = [
|
||||||
'E402', 'E501', 'W503', 'E711', 'E128', 'E226',
|
'E402', 'E501', 'W503', 'E711', 'E226',
|
||||||
'E126', 'E121', 'E123', 'E266', 'E265', 'E261', 'E221',
|
'E126', 'E121', 'E123', 'E266', 'E265', 'E261', 'E221',
|
||||||
'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E731', 'E302',
|
'E241', 'E712', 'E702', 'E401', 'E115', 'E114', 'E731', 'E302',
|
||||||
'E741', 'E714', 'W391', 'E713', 'E305', 'E251', 'E306',
|
'E741', 'E714', 'W391', 'E713', 'E305', 'E251', 'E306',
|
||||||
|
@ -331,7 +331,7 @@ def build_custom_checkers(by_lang):
|
||||||
{'pattern': 'self\.client\.(get|post|patch|put|delete)',
|
{'pattern': 'self\.client\.(get|post|patch|put|delete)',
|
||||||
'exclude': set(['zilencer/tests.py']),
|
'exclude': set(['zilencer/tests.py']),
|
||||||
'description': \
|
'description': \
|
||||||
'''Do not call self.client directly for put/patch/post/get.
|
'''Do not call self.client directly for put/patch/post/get.
|
||||||
See WRAPPER_COMMENT in test_helpers.py for details.
|
See WRAPPER_COMMENT in test_helpers.py for details.
|
||||||
'''},
|
'''},
|
||||||
|
|
||||||
|
@ -427,20 +427,20 @@ def run():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--force', default=False,
|
parser.add_option('--force', default=False,
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Run tests despite possible problems.')
|
help='Run tests despite possible problems.')
|
||||||
parser.add_option('--full',
|
parser.add_option('--full',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Check some things we typically ignore')
|
help='Check some things we typically ignore')
|
||||||
parser.add_option('--pep8',
|
parser.add_option('--pep8',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Run the pep8 checker')
|
help='Run the pep8 checker')
|
||||||
parser.add_option('--modified', '-m',
|
parser.add_option('--modified', '-m',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Only check modified files')
|
help='Only check modified files')
|
||||||
parser.add_option('--verbose', '-v',
|
parser.add_option('--verbose', '-v',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Print verbose timing output')
|
help='Print verbose timing output')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
tools_dir = os.path.dirname(os.path.abspath(__file__))
|
tools_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -460,9 +460,11 @@ def run():
|
||||||
print('If you really know what you are doing, use --force to run anyway.')
|
print('If you really know what you are doing, use --force to run anyway.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
by_lang = cast(Dict[str, List[str]], lister.list_files(args, modified_only=options.modified,
|
by_lang = cast(Dict[str, List[str]],
|
||||||
ftypes=['py', 'sh', 'js', 'pp', 'css', 'handlebars', 'html', 'json', 'md', 'txt', 'text'],
|
lister.list_files(args, modified_only=options.modified,
|
||||||
use_shebang=True, group_by_ftype=True, exclude=EXCLUDED_FILES))
|
ftypes=['py', 'sh', 'js', 'pp', 'css', 'handlebars',
|
||||||
|
'html', 'json', 'md', 'txt', 'text'],
|
||||||
|
use_shebang=True, group_by_ftype=True, exclude=EXCLUDED_FILES))
|
||||||
|
|
||||||
# Invoke the appropriate lint checker for each language,
|
# Invoke the appropriate lint checker for each language,
|
||||||
# and also check files for extra whitespace.
|
# and also check files for extra whitespace.
|
||||||
|
|
|
@ -15,7 +15,7 @@ from typing import Optional, Set
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--prev-deploy', metavar='DIR',
|
parser.add_argument('--prev-deploy', metavar='DIR',
|
||||||
help='a previous deploy from which to reuse files if possible')
|
help='a previous deploy from which to reuse files if possible')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
prev_deploy = args.prev_deploy
|
prev_deploy = args.prev_deploy
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ if __name__ == "__main__":
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
test_runner = TestRunner()
|
test_runner = TestRunner()
|
||||||
failures = test_runner.run_tests(suites, fatal_errors=options.fatal_errors,
|
failures = test_runner.run_tests(suites, fatal_errors=options.fatal_errors,
|
||||||
full_suite=full_suite)
|
full_suite=full_suite)
|
||||||
|
|
||||||
templates_not_rendered = test_runner.get_shallow_tested_templates()
|
templates_not_rendered = test_runner.get_shallow_tested_templates()
|
||||||
if templates_not_rendered and full_suite:
|
if templates_not_rendered and full_suite:
|
||||||
|
|
|
@ -11,8 +11,8 @@ import unittest
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--coverage', dest='coverage',
|
parser.add_argument('--coverage', dest='coverage',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False, help='compute test coverage')
|
default=False, help='compute test coverage')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
def dir_join(dir1, dir2):
|
def dir_join(dir1, dir2):
|
||||||
|
|
|
@ -18,7 +18,7 @@ from scripts.lib.node_cache import setup_node_modules
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--prev-deploy', metavar='DIR',
|
parser.add_argument('--prev-deploy', metavar='DIR',
|
||||||
help='a previous deploy from which to reuse files if possible')
|
help='a previous deploy from which to reuse files if possible')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
prev_deploy = args.prev_deploy
|
prev_deploy = args.prev_deploy
|
||||||
|
|
||||||
|
|
|
@ -17,21 +17,21 @@ def run():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
"""Builds for production, writing the output to disk"""
|
"""Builds for production, writing the output to disk"""
|
||||||
subprocess.check_call(['node', 'node_modules/.bin/webpack'] +
|
subprocess.check_call(['node', 'node_modules/.bin/webpack'] +
|
||||||
['--config', 'tools/webpack.production.config.js'])
|
['--config', 'tools/webpack.production.config.js'])
|
||||||
|
|
||||||
def run_watch(port):
|
def run_watch(port):
|
||||||
# type: (str) -> None
|
# type: (str) -> None
|
||||||
"""watches and rebuilds on changes, serving files from memory via webpack-dev-server"""
|
"""watches and rebuilds on changes, serving files from memory via webpack-dev-server"""
|
||||||
subprocess.Popen(['node', 'node_modules/.bin/webpack-dev-server'] +
|
subprocess.Popen(['node', 'node_modules/.bin/webpack-dev-server'] +
|
||||||
['--config', 'tools/webpack.config.js', '--watch-poll', '--port', port])
|
['--config', 'tools/webpack.config.js', '--watch-poll', '--port', port])
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--watch',
|
parser.add_argument('--watch',
|
||||||
action='store_true', dest='watch', default=False,
|
action='store_true', dest='watch', default=False,
|
||||||
help='watch for changes to source files (for development)')
|
help='watch for changes to source files (for development)')
|
||||||
parser.add_argument('--port',
|
parser.add_argument('--port',
|
||||||
action='store', dest='port',
|
action='store', dest='port',
|
||||||
default='9994', help='set the port for the webpack server to run on')
|
default='9994', help='set the port for the webpack server to run on')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.watch:
|
if args.watch:
|
||||||
|
|
|
@ -122,8 +122,8 @@ def log_event(event):
|
||||||
os.mkdir(settings.EVENT_LOG_DIR)
|
os.mkdir(settings.EVENT_LOG_DIR)
|
||||||
|
|
||||||
template = os.path.join(settings.EVENT_LOG_DIR,
|
template = os.path.join(settings.EVENT_LOG_DIR,
|
||||||
'%s.' + platform.node()
|
'%s.' + platform.node()
|
||||||
+ datetime.datetime.now().strftime('.%Y-%m-%d'))
|
+ datetime.datetime.now().strftime('.%Y-%m-%d'))
|
||||||
|
|
||||||
with lockfile(template % ('lock',)):
|
with lockfile(template % ('lock',)):
|
||||||
with open(template % ('events',), 'a') as log:
|
with open(template % ('events',), 'a') as log:
|
||||||
|
@ -227,21 +227,26 @@ def send_signup_message(sender, signups_stream, user_profile,
|
||||||
# Send notification to realm notifications stream if it exists
|
# Send notification to realm notifications stream if it exists
|
||||||
# Don't send notification for the first user in a realm
|
# Don't send notification for the first user in a realm
|
||||||
if user_profile.realm.notifications_stream is not None and user_count > 1:
|
if user_profile.realm.notifications_stream is not None and user_count > 1:
|
||||||
internal_send_message(sender, "stream",
|
internal_send_message(
|
||||||
user_profile.realm.notifications_stream.name,
|
sender,
|
||||||
"New users", "%s just signed up for Zulip. Say hello!" %
|
"stream",
|
||||||
(user_profile.full_name,),
|
user_profile.realm.notifications_stream.name,
|
||||||
realm=user_profile.realm)
|
"New users", "%s just signed up for Zulip. Say hello!" % (
|
||||||
|
user_profile.full_name,),
|
||||||
|
realm=user_profile.realm)
|
||||||
|
|
||||||
internal_send_message(sender,
|
internal_send_message(
|
||||||
"stream", signups_stream, user_profile.realm.domain,
|
sender,
|
||||||
"%s <`%s`> just signed up for Zulip!%s(total: **%i**)" % (
|
"stream",
|
||||||
user_profile.full_name,
|
signups_stream,
|
||||||
user_profile.email,
|
user_profile.realm.domain,
|
||||||
internal_blurb,
|
"%s <`%s`> just signed up for Zulip!%s(total: **%i**)" % (
|
||||||
user_count,
|
user_profile.full_name,
|
||||||
)
|
user_profile.email,
|
||||||
)
|
internal_blurb,
|
||||||
|
user_count,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def notify_new_user(user_profile, internal=False):
|
def notify_new_user(user_profile, internal=False):
|
||||||
# type: (UserProfile, bool) -> None
|
# type: (UserProfile, bool) -> None
|
||||||
|
@ -303,13 +308,16 @@ def process_new_human_user(user_profile, prereg_user=None, newsletter_data=None)
|
||||||
if not mit_beta_user and prereg_user is not None and prereg_user.referred_by is not None \
|
if not mit_beta_user and prereg_user is not None and prereg_user.referred_by is not None \
|
||||||
and settings.NOTIFICATION_BOT is not None:
|
and settings.NOTIFICATION_BOT is not None:
|
||||||
# This is a cross-realm private message.
|
# This is a cross-realm private message.
|
||||||
internal_send_message(settings.NOTIFICATION_BOT,
|
internal_send_message(
|
||||||
"private", prereg_user.referred_by.email, user_profile.realm.domain,
|
settings.NOTIFICATION_BOT,
|
||||||
"%s <`%s`> accepted your invitation to join Zulip!" % (
|
"private",
|
||||||
user_profile.full_name,
|
prereg_user.referred_by.email,
|
||||||
user_profile.email,
|
user_profile.realm.domain,
|
||||||
)
|
"%s <`%s`> accepted your invitation to join Zulip!" % (
|
||||||
)
|
user_profile.full_name,
|
||||||
|
user_profile.email,
|
||||||
|
)
|
||||||
|
)
|
||||||
# Mark any other PreregistrationUsers that are STATUS_ACTIVE as
|
# Mark any other PreregistrationUsers that are STATUS_ACTIVE as
|
||||||
# inactive so we can keep track of the PreregistrationUser we
|
# inactive so we can keep track of the PreregistrationUser we
|
||||||
# actually used for analytics
|
# actually used for analytics
|
||||||
|
@ -1508,7 +1516,7 @@ def notify_subscriptions_added(user_profile, sub_pairs, stream_emails, no_log=Fa
|
||||||
description=stream.description,
|
description=stream.description,
|
||||||
pin_to_top=subscription.pin_to_top,
|
pin_to_top=subscription.pin_to_top,
|
||||||
subscribers=stream_emails(stream))
|
subscribers=stream_emails(stream))
|
||||||
for (subscription, stream) in sub_pairs]
|
for (subscription, stream) in sub_pairs]
|
||||||
event = dict(type="subscription", op="add",
|
event = dict(type="subscription", op="add",
|
||||||
subscriptions=payload)
|
subscriptions=payload)
|
||||||
send_event(event, [user_profile.id])
|
send_event(event, [user_profile.id])
|
||||||
|
@ -2862,7 +2870,7 @@ def gather_subscriptions_helper(user_profile):
|
||||||
stream_ids = set([sub["recipient__type_id"] for sub in sub_dicts])
|
stream_ids = set([sub["recipient__type_id"] for sub in sub_dicts])
|
||||||
all_streams = get_active_streams(user_profile.realm).select_related(
|
all_streams = get_active_streams(user_profile.realm).select_related(
|
||||||
"realm").values("id", "name", "invite_only", "realm_id",
|
"realm").values("id", "name", "invite_only", "realm_id",
|
||||||
"realm__domain", "email_token", "description")
|
"realm__domain", "email_token", "description")
|
||||||
|
|
||||||
stream_dicts = [stream for stream in all_streams if stream['id'] in stream_ids]
|
stream_dicts = [stream for stream in all_streams if stream['id'] in stream_ids]
|
||||||
stream_hash = {}
|
stream_hash = {}
|
||||||
|
|
|
@ -1053,13 +1053,13 @@ class Bugdown(markdown.Extension):
|
||||||
|
|
||||||
# Custom bold syntax: **foo** but not __foo__
|
# Custom bold syntax: **foo** but not __foo__
|
||||||
md.inlinePatterns.add('strong',
|
md.inlinePatterns.add('strong',
|
||||||
markdown.inlinepatterns.SimpleTagPattern(r'(\*\*)([^\n]+?)\2', 'strong'),
|
markdown.inlinepatterns.SimpleTagPattern(r'(\*\*)([^\n]+?)\2', 'strong'),
|
||||||
'>not_strong')
|
'>not_strong')
|
||||||
|
|
||||||
# Custom strikethrough syntax: ~~foo~~
|
# Custom strikethrough syntax: ~~foo~~
|
||||||
md.inlinePatterns.add('del',
|
md.inlinePatterns.add('del',
|
||||||
markdown.inlinepatterns.SimpleTagPattern(r'(?<!~)(\~\~)([^~{0}\n]+?)\2(?!~)', 'del'),
|
markdown.inlinepatterns.SimpleTagPattern(r'(?<!~)(\~\~)([^~{0}\n]+?)\2(?!~)', 'del'),
|
||||||
'>strong')
|
'>strong')
|
||||||
|
|
||||||
# Text inside ** must start and end with a word character
|
# Text inside ** must start and end with a word character
|
||||||
# it need for things like "const char *x = (char *)y"
|
# it need for things like "const char *x = (char *)y"
|
||||||
|
@ -1078,7 +1078,7 @@ class Bugdown(markdown.Extension):
|
||||||
md.inlinePatterns.add('gravatar', Avatar(r'!gravatar\((?P<email>[^)]*)\)'), '>backtick')
|
md.inlinePatterns.add('gravatar', Avatar(r'!gravatar\((?P<email>[^)]*)\)'), '>backtick')
|
||||||
|
|
||||||
md.inlinePatterns.add('stream_subscribe_button',
|
md.inlinePatterns.add('stream_subscribe_button',
|
||||||
StreamSubscribeButton(r'!_stream_subscribe_button\((?P<stream_name>(?:[^)\\]|\\\)|\\)*)\)'), '>backtick')
|
StreamSubscribeButton(r'!_stream_subscribe_button\((?P<stream_name>(?:[^)\\]|\\\)|\\)*)\)'), '>backtick')
|
||||||
md.inlinePatterns.add(
|
md.inlinePatterns.add(
|
||||||
'modal_link',
|
'modal_link',
|
||||||
ModalLink(r'!modal_link\((?P<relative_url>[^)]*), (?P<text>[^)]*)\)'),
|
ModalLink(r'!modal_link\((?P<relative_url>[^)]*), (?P<text>[^)]*)\)'),
|
||||||
|
@ -1229,7 +1229,7 @@ def make_realm_filters(domain, filters):
|
||||||
# Because of how the Markdown config API works, this has confusing
|
# Because of how the Markdown config API works, this has confusing
|
||||||
# large number of layers of dicts/arrays :(
|
# large number of layers of dicts/arrays :(
|
||||||
make_md_engine(domain, {"realm_filters": [filters, "Realm-specific filters for %s" % (domain,)],
|
make_md_engine(domain, {"realm_filters": [filters, "Realm-specific filters for %s" % (domain,)],
|
||||||
"realm": [domain, "Realm name"]})
|
"realm": [domain, "Realm name"]})
|
||||||
|
|
||||||
def maybe_update_realm_filters(domain):
|
def maybe_update_realm_filters(domain):
|
||||||
# type: (Optional[Text]) -> None
|
# type: (Optional[Text]) -> None
|
||||||
|
@ -1326,11 +1326,11 @@ def do_convert(content, realm_domain=None, message=None, possible_words=None):
|
||||||
|
|
||||||
# Output error to log as well as sending a zulip and email
|
# Output error to log as well as sending a zulip and email
|
||||||
log_bugdown_error('Exception in Markdown parser: %sInput (sanitized) was: %s'
|
log_bugdown_error('Exception in Markdown parser: %sInput (sanitized) was: %s'
|
||||||
% (traceback.format_exc(), cleaned))
|
% (traceback.format_exc(), cleaned))
|
||||||
subject = "Markdown parser failure on %s" % (platform.node(),)
|
subject = "Markdown parser failure on %s" % (platform.node(),)
|
||||||
if settings.ERROR_BOT is not None:
|
if settings.ERROR_BOT is not None:
|
||||||
internal_send_message(settings.ERROR_BOT, "stream",
|
internal_send_message(settings.ERROR_BOT, "stream",
|
||||||
"errors", subject, "Markdown parser failed, email sent with details.")
|
"errors", subject, "Markdown parser failed, email sent with details.")
|
||||||
mail.mail_admins(subject, "Failed message: %s\n\n%s\n\n" % (
|
mail.mail_admins(subject, "Failed message: %s\n\n%s\n\n" % (
|
||||||
cleaned, traceback.format_exc()),
|
cleaned, traceback.format_exc()),
|
||||||
fail_silently=False)
|
fail_silently=False)
|
||||||
|
|
|
@ -100,8 +100,8 @@ class FencedCodeExtension(markdown.Extension):
|
||||||
# Newer versions of Python-Markdown (starting at 2.3?) have
|
# Newer versions of Python-Markdown (starting at 2.3?) have
|
||||||
# a normalize_whitespace preprocessor that needs to go first.
|
# a normalize_whitespace preprocessor that needs to go first.
|
||||||
position = ('>normalize_whitespace'
|
position = ('>normalize_whitespace'
|
||||||
if 'normalize_whitespace' in md.preprocessors
|
if 'normalize_whitespace' in md.preprocessors
|
||||||
else '_begin')
|
else '_begin')
|
||||||
|
|
||||||
md.preprocessors.add('fenced_code_block',
|
md.preprocessors.add('fenced_code_block',
|
||||||
FencedBlockPreprocessor(md),
|
FencedBlockPreprocessor(md),
|
||||||
|
@ -259,13 +259,13 @@ class FencedBlockPreprocessor(markdown.preprocessors.Preprocessor):
|
||||||
# is enabled, so we call it to highlite the code
|
# is enabled, so we call it to highlite the code
|
||||||
if self.codehilite_conf:
|
if self.codehilite_conf:
|
||||||
highliter = CodeHilite(text,
|
highliter = CodeHilite(text,
|
||||||
linenums=self.codehilite_conf['linenums'][0],
|
linenums=self.codehilite_conf['linenums'][0],
|
||||||
guess_lang=self.codehilite_conf['guess_lang'][0],
|
guess_lang=self.codehilite_conf['guess_lang'][0],
|
||||||
css_class=self.codehilite_conf['css_class'][0],
|
css_class=self.codehilite_conf['css_class'][0],
|
||||||
style=self.codehilite_conf['pygments_style'][0],
|
style=self.codehilite_conf['pygments_style'][0],
|
||||||
use_pygments=self.codehilite_conf['use_pygments'][0],
|
use_pygments=self.codehilite_conf['use_pygments'][0],
|
||||||
lang=(lang or None),
|
lang=(lang or None),
|
||||||
noclasses=self.codehilite_conf['noclasses'][0])
|
noclasses=self.codehilite_conf['noclasses'][0])
|
||||||
|
|
||||||
code = highliter.hilite()
|
code = highliter.hilite()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -88,7 +88,7 @@ def gather_hot_conversations(user_profile, stream_messages):
|
||||||
|
|
||||||
# We'll display up to 2 messages from the conversation.
|
# We'll display up to 2 messages from the conversation.
|
||||||
first_few_messages = [user_message.message for user_message in
|
first_few_messages = [user_message.message for user_message in
|
||||||
stream_messages.filter(
|
stream_messages.filter(
|
||||||
message__recipient__type_id=stream_id,
|
message__recipient__type_id=stream_id,
|
||||||
message__subject=subject)[:2]]
|
message__subject=subject)[:2]]
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Usage: ./manage.py import [--destroy-rebuild-database] [--import-into-nonempty]
|
||||||
count = model.objects.count()
|
count = model.objects.count()
|
||||||
if count:
|
if count:
|
||||||
print("Zulip instance is not empty, found %d rows in %s table. "
|
print("Zulip instance is not empty, found %d rows in %s table. "
|
||||||
% (count, model._meta.db_table))
|
% (count, model._meta.db_table))
|
||||||
print("You may use --destroy-rebuild-database to destroy and rebuild the database prior to import.")
|
print("You may use --destroy-rebuild-database to destroy and rebuild the database prior to import.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ Usage: ./manage.py import [--destroy-rebuild-database] [--import-into-nonempty]
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# type: (*Any, **Any) -> None
|
# type: (*Any, **Any) -> None
|
||||||
models_to_import = [Realm, Stream, UserProfile, Recipient, Subscription,
|
models_to_import = [Realm, Stream, UserProfile, Recipient, Subscription,
|
||||||
Client, Message, UserMessage, Huddle, DefaultStream, RealmAlias,
|
Client, Message, UserMessage, Huddle, DefaultStream, RealmAlias,
|
||||||
RealmFilter]
|
RealmFilter]
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
print("Please provide at least one realm dump to import.")
|
print("Please provide at least one realm dump to import.")
|
||||||
|
|
|
@ -241,7 +241,7 @@ class LoginTest(ZulipTestCase):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
realm = get_realm_by_string_id("zulip")
|
realm = get_realm_by_string_id("zulip")
|
||||||
stream_dict = {"stream_"+str(i): {"description": "stream_%s_description" % i, "invite_only": False}
|
stream_dict = {"stream_"+str(i): {"description": "stream_%s_description" % i, "invite_only": False}
|
||||||
for i in range(40)} # type: Dict[Text, Dict[Text, Any]]
|
for i in range(40)} # type: Dict[Text, Dict[Text, Any]]
|
||||||
for stream_name in stream_dict.keys():
|
for stream_name in stream_dict.keys():
|
||||||
self.make_stream(stream_name, realm=realm)
|
self.make_stream(stream_name, realm=realm)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class MentionHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named mention_webfeeds
|
# use fixture named mention_webfeeds
|
||||||
self.send_and_test_stream_message('webfeeds', expected_topic, expected_message,
|
self.send_and_test_stream_message('webfeeds', expected_topic, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def get_body(self, fixture_name):
|
def get_body(self, fixture_name):
|
||||||
# type: (Text) -> Text
|
# type: (Text) -> Text
|
||||||
|
|
|
@ -23,7 +23,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_charge_dispute_created
|
# use fixture named stripe_charge_dispute_created
|
||||||
self.send_and_test_stream_message('charge_dispute_created', expected_subject, expected_message,
|
self.send_and_test_stream_message('charge_dispute_created', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_charge_failed(self):
|
def test_charge_failed(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -32,7 +32,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_charge_failed
|
# use fixture named stripe_charge_failed
|
||||||
self.send_and_test_stream_message('charge_failed', expected_subject, expected_message,
|
self.send_and_test_stream_message('charge_failed', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_charge_succeeded(self):
|
def test_charge_succeeded(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -41,7 +41,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_charge_succeeded
|
# use fixture named stripe_charge_succeeded
|
||||||
self.send_and_test_stream_message('charge_succeeded', expected_subject, expected_message,
|
self.send_and_test_stream_message('charge_succeeded', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_created_email(self):
|
def test_customer_created_email(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -50,7 +50,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_created_email
|
# use fixture named stripe_customer_created_email
|
||||||
self.send_and_test_stream_message('customer_created_email', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_created_email', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_created(self):
|
def test_customer_created(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -59,7 +59,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_created
|
# use fixture named stripe_customer_created
|
||||||
self.send_and_test_stream_message('customer_created', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_created', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_deleted(self):
|
def test_customer_deleted(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -68,7 +68,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_deleted
|
# use fixture named stripe_customer_deleted
|
||||||
self.send_and_test_stream_message('customer_deleted', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_deleted', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_subscription_created(self):
|
def test_customer_subscription_created(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -77,7 +77,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_subscription_created
|
# use fixture named stripe_customer_subscription_created
|
||||||
self.send_and_test_stream_message('customer_subscription_created', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_subscription_created', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_subscription_deleted(self):
|
def test_customer_subscription_deleted(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -86,7 +86,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_subscription_deleted
|
# use fixture named stripe_customer_subscription_deleted
|
||||||
self.send_and_test_stream_message('customer_subscription_deleted', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_subscription_deleted', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_customer_subscription_trial_will_end(self):
|
def test_customer_subscription_trial_will_end(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -95,7 +95,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_customer_subscription_trial_will_end
|
# use fixture named stripe_customer_subscription_trial_will_end
|
||||||
self.send_and_test_stream_message('customer_subscription_trial_will_end', expected_subject, expected_message,
|
self.send_and_test_stream_message('customer_subscription_trial_will_end', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_invoice_payment_failed(self):
|
def test_invoice_payment_failed(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -104,7 +104,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_invoice_payment_failed
|
# use fixture named stripe_invoice_payment_failed
|
||||||
self.send_and_test_stream_message('invoice_payment_failed', expected_subject, expected_message,
|
self.send_and_test_stream_message('invoice_payment_failed', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_order_payment_failed(self):
|
def test_order_payment_failed(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -113,7 +113,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_order_payment_failed
|
# use fixture named stripe_order_payment_failed
|
||||||
self.send_and_test_stream_message('order_payment_failed', expected_subject, expected_message,
|
self.send_and_test_stream_message('order_payment_failed', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_order_payment_succeeded(self):
|
def test_order_payment_succeeded(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -122,7 +122,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_order_payment_succeeded
|
# use fixture named stripe_order_payment_succeeded
|
||||||
self.send_and_test_stream_message('order_payment_succeeded', expected_subject, expected_message,
|
self.send_and_test_stream_message('order_payment_succeeded', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_order_updated(self):
|
def test_order_updated(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -131,7 +131,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_order_updated
|
# use fixture named stripe_order_updated
|
||||||
self.send_and_test_stream_message('order_updated', expected_subject, expected_message,
|
self.send_and_test_stream_message('order_updated', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_transfer_failed(self):
|
def test_transfer_failed(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -140,7 +140,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_transfer_failed
|
# use fixture named stripe_transfer_failed
|
||||||
self.send_and_test_stream_message('transfer_failed', expected_subject, expected_message,
|
self.send_and_test_stream_message('transfer_failed', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def test_transfer_paid(self):
|
def test_transfer_paid(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -149,7 +149,7 @@ class StripeHookTests(WebhookTestCase):
|
||||||
|
|
||||||
# use fixture named stripe_transfer_paid
|
# use fixture named stripe_transfer_paid
|
||||||
self.send_and_test_stream_message('transfer_paid', expected_subject, expected_message,
|
self.send_and_test_stream_message('transfer_paid', expected_subject, expected_message,
|
||||||
content_type="application/x-www-form-urlencoded")
|
content_type="application/x-www-form-urlencoded")
|
||||||
|
|
||||||
def get_body(self, fixture_name):
|
def get_body(self, fixture_name):
|
||||||
# type: (Text) -> Text
|
# type: (Text) -> Text
|
||||||
|
|
|
@ -63,12 +63,13 @@ def api_pivotal_webhook_v3(request, user_profile, stream):
|
||||||
if estimate != '':
|
if estimate != '':
|
||||||
estimate = " worth %s story points" % (estimate,)
|
estimate = " worth %s story points" % (estimate,)
|
||||||
subject = name
|
subject = name
|
||||||
content = "%s (%s %s%s):\n\n~~~ quote\n%s\n~~~\n\n%s" % (description,
|
content = "%s (%s %s%s):\n\n~~~ quote\n%s\n~~~\n\n%s" % (
|
||||||
issue_status,
|
description,
|
||||||
issue_type,
|
issue_status,
|
||||||
estimate,
|
issue_type,
|
||||||
issue_desc,
|
estimate,
|
||||||
more_info)
|
issue_desc,
|
||||||
|
more_info)
|
||||||
return subject, content
|
return subject, content
|
||||||
|
|
||||||
def api_pivotal_webhook_v5(request, user_profile, stream):
|
def api_pivotal_webhook_v5(request, user_profile, stream):
|
||||||
|
|
Loading…
Reference in New Issue