<commit_before>import json
import os
import unittest2 as unittest
from ConfigParser import ConfigParser

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait


config = {}
browser = None  # populated in setUpModule


def splitlines(s):
    return filter(None, [x.strip() for x in s.splitlines()])


def setUpModule():
    global browser, config

    inipath = os.environ.get('TEST_INI', 'testing.ini')
    if os.path.isfile(inipath):
        parser = ConfigParser()
        parser.read(inipath)

        config = dict(parser.items('testconfig'))
        config['test_providers'] = splitlines(config['test_providers'])
        config['base_url'] = 'http://localhost:5000'

    driver = config.get('selenium.driver', 'firefox')
    browser = {
        'firefox': webdriver.Firefox,
        'chrome': webdriver.Chrome,
        'ie': webdriver.Ie,
    }[driver]()


def tearDownModule():
    if browser is not None:
        browser.quit()


class ProviderTests(object):

    @classmethod
    def require_provider(cls, name):
        if name not in config.get('test_providers', []):
            raise unittest.SkipTest('tests not enabled for "%s"' % name)


class TestFacebook(ProviderTests, unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.require_provider('facebook')
        cls.login = config['facebook.login']
        cls.password = config['facebook.password']
        cls.app = config['facebook.app']
<commit_msg>note about facebook's test api<commit_after>import json
import os
import unittest2 as unittest
from ConfigParser import ConfigParser

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait


config = {}
browser = None  # populated in setUpModule


def splitlines(s):
    return filter(None, [x.strip() for x in s.splitlines()])


def setUpModule():
    global browser, config

    inipath = os.environ.get('TEST_INI', 'testing.ini')
    if os.path.isfile(inipath):
        parser = ConfigParser()
        parser.read(inipath)

        config = dict(parser.items('testconfig'))
        config['test_providers'] = splitlines(config['test_providers'])
        config['base_url'] = 'http://localhost:5000'

    driver = config.get('selenium.driver', 'firefox')
    browser = {
        'firefox': webdriver.Firefox,
        'chrome': webdriver.Chrome,
        'ie': webdriver.Ie,
    }[driver]()


def tearDownModule():
    if browser is not None:
        browser.quit()


class ProviderTests(object):

    @classmethod
    def require_provider(cls, name):
        if name not in config.get('test_providers', []):
            raise unittest.SkipTest('tests not enabled for "%s"' % name)


class TestFacebook(ProviderTests, unittest.TestCase):
    """
    TODO: look into adding multiple tests using test users with varying
          levels of functionality.

          http://developers.facebook.com/docs/test_users/
    """

    @classmethod
    def setUpClass(cls):
        cls.require_provider('facebook')
        cls.login = config['facebook.login']
        cls.password = config['facebook.password']
        cls.app = config['facebook.app']

{'fraction_non_alphanumeric': 0.12043215761042263, 'fraction_numerical': 0.0031776294884016524, 'mean_word_length': 3.214190093708166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4976355', 'n_tokens_mistral': 956, 'n_tokens_neox': 905, 'n_words': 227}