Taking another look at our Mozilla Persona spike, we need something like this:
var loggedInUser = '{{ user.email }}' || null;
var csrf_token = '{{ csrf_token }}';
console.log(loggedInUser);
navigator.id.watch({
import logging | |
import sys | |
from unittest.mock import patch # reqs. python 3. change to from mock if p2. | |
from django.conf.urls import url | |
from django.http import HttpResponse | |
from django.test import TestCase | |
from .urls import urlpatterns | |
## test assumes a bare django project created called "myproj" |
#!/usr/bin/env python3 | |
from collections import namedtuple | |
import csv | |
from datetime import datetime | |
import os | |
import re | |
import subprocess | |
Commit = namedtuple('Commit', ['hash', 'subject', 'date']) | |
WordCount = namedtuple('WordCount', ['filename', 'lines', 'words']) |
var system = require('system'); | |
if (!system.args[1]){ | |
console.log('Pass path to test file as second arg'); | |
phantom.exit(); | |
} | |
var path = system.args[1]; | |
if (path.indexOf('/') !== 0) { | |
path = system.env.PWD + '/' + path; |
from selenium import webdriver | |
import sys | |
if 'phantom' in sys.argv: | |
browser = webdriver.PhantomJS() | |
else: | |
browser = webdriver.Firefox() | |
browser.implicitly_wait(3) |
from selenium import webdriver | |
import sys | |
if 'phantom' in sys.argv: | |
browser = webdriver.PhantomJS() | |
else: | |
browser = webdriver.Firefox() | |
browser.implicitly_wait(3) |
PythonAnywhere launches "Startup" Plan | |
== For immediate release == | |
LONDON, United Kindgdom. PythonAnywhere LLP, the creators of the popular | |
browser-based Python development and hosting platform PythonAnywhere, | |
announced the launch of their higher-end "Startup" plan today. | |
CEO Giles Thomas said "We've been growing with our users, and many of | |
them have been hosting high-volume, high traffic sites with us for |
Taking another look at our Mozilla Persona spike, we need something like this:
var loggedInUser = '{{ user.email }}' || null;
var csrf_token = '{{ csrf_token }}';
console.log(loggedInUser);
navigator.id.watch({
Fast and slow is really a misnomer. We're really talking about "pure" unit tests, which are highly isolated from each other, and will require the use of mocks (unless the code follows a functional paradigm), or "impure" unit tests, which involve more dependencies.
mocky/isolated tests | Non-mocky/ high-dependency / integratey tests |
---|
#!/usr/bin/env python3 | |
import difflib | |
import urllib.request | |
import os | |
import selenium | |
import imp | |
import shutil | |
target_dir = os.path.dirname(selenium.__file__) |
def fix_dict_repr_order(string): | |
dict_finder = r"({'\w+': .+, '\w+': .+})" | |
if not re.search(dict_finder, string): | |
return string | |
for dict_repr in re.findall(dict_finder, string): | |
items = re.search( | |
r"{('\w+': .+), ('\w+': .+)}", | |
dict_repr, | |
).groups() |