# Path: stackalytics/dashboard/helpers.py
# INFINITY_HTML = '&#x221E;'
# def _extend_author_fields(record):
# def _extend_record_common_fields(record):
# def _extend_by_parent_info(record, parent, prefix='parent_'):
# def extend_record(record):
# def get_current_company(user):
# def extend_user(user):
# def extend_module(module_id, project_type, release):
# def get_activity(records, start_record, page_size, query_message=None):
# def get_contribution_summary(records):
# def format_datetime(timestamp):
# def format_date(timestamp):
# def format_launchpad_module_link(module):
# def make_link(title, uri=None, options=None):
# def make_blueprint_link(module, name):
# def make_commit_message(record):
# def make_page_title(project_type_inst, release, module_inst, company,
#                     user_inst):
# def filter_bug_title(title):


import mock
import testtools
from stackalytics.dashboard import helpers
            }],
            'id': 'smith',
            'company_link': company_link,
            'text': 'John Smith',
        }

        observed = helpers.extend_user(user)
        self.assertEqual(expected, observed)
        mock_make_link.assert_called_once_with('TheCompany', '/', mock.ANY)

    @mock.patch('time.time')
    @mock.patch('stackalytics.dashboard.helpers.make_link')
    def test_extend_user_current_company(self, mock_make_link, mock_time_time):
        company_link = mock.Mock()
        mock_make_link.return_value = company_link
        current_timestamp = 1234567890
        mock_time_time.return_value = current_timestamp

        user = {
            'user_id': 'smith',
            'user_name': 'John Smith',
            'companies': [{
                'company_name': 'Current',
                'end_date': current_timestamp + 1
            }, {
                'company_name': 'TheCompany',
                'end_date': 0
            }]
        }


# Path: stackalytics/dashboard/helpers.py
# INFINITY_HTML = '&#x221E;'
# def _extend_author_fields(record):
# def _extend_record_common_fields(record):
# def _extend_by_parent_info(record, parent, prefix='parent_'):
# def extend_record(record):
# def get_current_company(user):
# def extend_user(user):
# def extend_module(module_id, project_type, release):
# def get_activity(records, start_record, page_size, query_message=None):
# def get_contribution_summary(records):
# def format_datetime(timestamp):
# def format_date(timestamp):
# def format_launchpad_module_link(module):
# def make_link(title, uri=None, options=None):
# def make_blueprint_link(module, name):
# def make_commit_message(record):
# def make_page_title(project_type_inst, release, module_inst, company,
#                     user_inst):
# def filter_bug_title(title):


# Path: stackalytics/tests/unit/test_helpers.py
import mock
import testtools
from stackalytics.dashboard import helpers

            }],
            'id': 'smith',
            'company_link': company_link,
            'text': 'John Smith',
        }

        observed = helpers.extend_user(user)
        self.assertEqual(expected, observed)
        mock_make_link.assert_called_once_with('TheCompany', '/', mock.ANY)

    @mock.patch('time.time')
    @mock.patch('stackalytics.dashboard.helpers.make_link')
    def test_extend_user_current_company(self, mock_make_link, mock_time_time):
        company_link = mock.Mock()
        mock_make_link.return_value = company_link
        current_timestamp = 1234567890
        mock_time_time.return_value = current_timestamp

        user = {
            'user_id': 'smith',
            'user_name': 'John Smith',
            'companies': [{
                'company_name': 'Current',
                'end_date': current_timestamp + 1
            }, {
                'company_name': 'TheCompany',
                'end_date': 0
            }]
        }


        helpers.extend_user(user)