本文整理汇总了Python中myjobs.tests.factories.UserFactory.save方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.save方法的具体用法?Python UserFactory.save怎么用?Python UserFactory.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myjobs.tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SavedSearchTemplateTagTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
class SavedSearchTemplateTagTests(MyJobsBase):
def setUp(self):
super(SavedSearchTemplateTagTests, self).setUp()
self.user = UserFactory(is_active=True)
self.search = SavedSearchFactory(user=self.user)
def test_confirm_creation_active_user(self):
expected = reverse('view_full_feed') + '?id={id}&verify={guid}'.format(
id=self.search.pk, guid=self.user.user_guid)
actual = get_created_url(self.search)
self.assertEqual(actual, expected)
def test_confirm_creation_inactive_user(self):
self.user.is_active = False
self.user.save()
user_with_profile = UserFactory(email='[email protected]',
is_active=False)
profile_search = SavedSearchFactory(user=user_with_profile)
ActivationProfile.objects.create(user=user_with_profile,
email=user_with_profile.email)
for saved_search in [self.search, profile_search]:
actual = get_created_url(saved_search)
profile = ActivationProfile.objects.get(user=saved_search.user)
expected = reverse('registration_activate',
args=[profile.activation_key]) + \
'?verify={guid}'.format(guid=saved_search.user.user_guid)
self.assertEqual(actual, expected)
示例2: test_search_updates_facet_counts
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_search_updates_facet_counts(self):
# Add ProfileData to the candidate_user
EducationFactory(user=self.candidate_user)
AddressFactory(user=self.candidate_user)
LicenseFactory(user=self.candidate_user)
self.candidate_user.save()
# Create a new user with ProfileData
user = UserFactory(email="[email protected]")
SavedSearchFactory(user=user,
url='http://test.jobs/search?q=python',
feed='http://test.jobs/jobs/feed/rss?',
label='Python Jobs')
EducationFactory(user=user)
AddressFactory(user=user)
LicenseFactory(user=user)
user.save()
update_solr_task(settings.TEST_SOLR_INSTANCE)
# Assert there are two users with country codes
country_tag = '#Country-details-table .facet-count'
q = '?company={company}'
q = q.format(company=str(self.company.id))
response = self.client.post(reverse('dashboard') + q)
soup = BeautifulSoup(response.content)
self.assertEqual(int(soup.select(country_tag)[0].text), 2)
# When we search, the facet count updates.
q = '?company={company}&search={search}'
q = q.format(company=str(self.company.id), search='find')
response = self.client.post(reverse('dashboard') + q)
soup = BeautifulSoup(response.content)
self.assertEqual(int(soup.select(country_tag)[0].text), 1)
示例3: test_not_disabled
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_not_disabled(self):
"""
An anonymous user who provides the :verify: query string or
user with is_disabled set to True should be redirected to the home
page. An anonymous user who does not should see a 404. A user with
is_active set to False should proceed to their destination.
"""
client = TestClient()
user = UserFactory()
#Anonymous user
resp = client.get(reverse('view_profile'))
path = resp.request.get('PATH_INFO')
self.assertRedirects(resp, reverse('home') + '?next=' + path)
# This is ugly, but it is an artifact of the way Django redirects
# users who fail the `user_passes_test` decorator.
qs = '?verify=%s' % user.user_guid
next_qs = '?next=' + urlquote('/profile/view/%s' % qs)
# Anonymous user navigates to url with :verify: in query string
resp = client.get(reverse('view_profile') + qs)
# Old path + qs is urlquoted and added to the url as the :next: param
self.assertRedirects(resp, "http://testserver/" + next_qs)
# Active user
client.login_user(user)
resp = client.get(reverse('view_profile'))
self.assertTrue(resp.status_code, 200)
#Disabled user
user.is_disabled = True
user.save()
resp = client.get(reverse('view_profile'))
self.assertRedirects(resp, "http://testserver/?next=/profile/view/")
示例4: NewUserTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
class NewUserTests(SeleniumTestCase):
"""Tests Account creation"""
def setUp(self):
self.user = UserFactory(first_name="John", last_name="Doe")
def test_home_page_works(self):
"""
As John, navigating to https://secure.my.jobs should send me to a page
titled "My.jobs".
"""
self.browser.get(self.live_server_url)
self.assertIn(self.browser.title, 'My.jobs')
def test_cant_log_in_without_account(self):
"""
As John, I shouldn't be able to log into My.jobs without registering
first.
"""
self.browser.get('/'.join([self.live_server_url, 'prm', 'view']))
# attempt to log in
username = self.find('id_username')
username.send_keys(self.user.email)
self.find('id_password').send_keys(self.user.password)
self.find('login').click()
self.assertEqual(username.get_attribute('placeholder'),
'Please enter a correct email.')
def test_user_registration(self):
"""
As John, I should be able to register on My.jobs and log in.
"""
user = UserFactory.build(email='[email protected]')
self.browser.get('/'.join([self.live_server_url, 'prm', 'view']))
# register
self.find('id_email').send_keys(user.email)
self.find('id_password1').send_keys(user.password)
self.find('id_password2').send_keys(user.password)
self.find('register').click()
self.assertEqual(self.find('profile').get_attribute(
'innerHTML'),
'Skip: Take me to my profile')
def test_user_login(self):
self.user.set_password("test")
self.user.save()
self.find('id_username').send_keys(self.user.email)
self.find('id_password').send_keys("test")
self.find('login').click()
示例5: test_presave_ignore
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_presave_ignore(self):
user = UserFactory(email="[email protected]")
update_solr_task(self.test_solr)
user.last_login = datetime.datetime(2011, 8, 15, 8, 15, 12, 0, pytz.UTC)
user.save()
self.assertEqual(Update.objects.all().count(), 0)
user.last_login = datetime.datetime(2013, 8, 15, 8, 15, 12, 0, pytz.UTC)
user.email = "[email protected]"
user.save()
self.assertEqual(Update.objects.all().count(), 1)
示例6: RedirectMiddlewareTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
class RedirectMiddlewareTests(MyJobsBase):
def setUp(self):
super(RedirectMiddlewareTests, self).setUp()
self.user = UserFactory()
self.redirect_middleware = PasswordChangeRedirectMiddleware()
self.request_factory = RequestFactory()
def test_logged_in_no_redirect(self):
"""
A logged in user whose password_change flag is not set
should proceed to their original destination
"""
request = self.request_factory.get(reverse('edit_account'))
request.user = self.user
response = self.redirect_middleware.process_request(request)
self.assertEqual(response, None)
def test_logged_in_autocreated_user_redirects(self):
"""
A logged in user whose password_change flag is set should
be redirected to the password change form
"""
self.user.password_change = True
self.user.save()
request = self.request_factory.get(reverse('saved_search_main'))
request.user = self.user
response = self.redirect_middleware.process_request(request)
self.assertEqual(response.status_code, 302)
self.assertEqual(response.get('location'),
reverse('edit_account')+"#as-password")
def test_not_logged_in_returns_forbidden(self):
"""
An anonymous user that tries to post to a private url should
receive a 403 Forbidden status
"""
request = self.request_factory.get(reverse('saved_search_main'),
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
new_request = request.GET.copy()
new_request['next'] = reverse('home')
request.GET = new_request
request.REQUEST.dicts = (new_request, request.POST)
request.user = AnonymousUser()
response = self.redirect_middleware.process_request(request)
self.assertEqual(response.status_code, 403)
示例7: test_search_domain
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_search_domain(self):
"""We should be able to search for domain."""
user = UserFactory(email="[email protected]")
SavedSearchFactory(user=user,
url='http://test.jobs/search?q=python',
feed='http://test.jobs/jobs/feed/rss?',
label='Python Jobs')
user.save()
update_solr_task(settings.TEST_SOLR_INSTANCE)
q = '?company={company}&search={search}'
q = q.format(company=str(self.company.id), search='shouldWork.com')
url = reverse('dashboard') + q
response = self.client.post(url)
soup = BeautifulSoup(response.content)
self.assertEqual(len(soup.select('#row-link-table tr')), 1)
示例8: test_inactive_user_sees_message
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_inactive_user_sees_message(self):
"""
A user with is_verified or is_active set to False should see an
activation message instead of the content they were originally meaning
to see.
"""
client = TestClient(path=reverse('saved_search_main'))
user = UserFactory()
# Active user
client.login_user(user)
resp = client.get()
self.assertIn('Saved Search', resp.content)
# Inactive user
user.is_verified= False
user.save()
resp = client.get()
self.assertIn('unavailable', resp.content)
示例9: test_is_active
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_is_active(self):
"""
A user with is_active set to False should be redirected to the home
page, while a user with is_active set to True should proceed to their
destination.
"""
client = TestClient()
user = UserFactory()
quoted_email = urllib.quote(user.email)
# Active user
client.login_user(user)
resp = client.get(reverse('saved_search_main'))
self.assertTrue(resp.status_code, 200)
# Inactive user
user.is_active = False
user.save()
resp = client.get(reverse('saved_search_main'))
self.assertRedirects(resp, "http://testserver/?next=/saved-search/view/")
示例10: AdminTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
class AdminTests(MyJobsBase):
def setUp(self):
super(AdminTests, self).setUp()
self.site = AdminSite()
settings.SITE = SeoSite.objects.first()
self.request = RequestFactory().get("/")
self.user = UserFactory(is_superuser=True)
self.request.user = self.user
def test_admin_request_form(self):
"""
The forms used by ValueEventAdmin and CronEventAdmin should have the
current request as attributes.
"""
for Admin, Model in [(ValueEventAdmin, ValueEvent), (CronEventAdmin, CronEvent)]:
admin = Admin(Model, self.site)
form = admin.get_form(self.request)()
self.assertEqual(form.request, self.request)
def test_non_superuser_form(self):
"""
The email_template queryset should have an appropriate WHERE clause
if the current user is not a company user.
"""
company = CompanyUserFactory(user=self.user).company
admin = ValueEventAdmin(ValueEvent, self.site)
for superuser in [True, False]:
self.user.is_superuser = superuser
self.user.save()
form = admin.get_form(self.request)()
email_template = form.fields["email_template"]
query = str(email_template.queryset.query)
if superuser:
self.assertFalse("WHERE" in query)
else:
if connection.vendor == "sqlite":
test = 'WHERE ("myemails_emailtemplate"."owner_id" = %s'
else:
test = "WHERE (`myemails_emailtemplate`.`owner_id` = %s"
self.assertTrue(test % company.pk in query)
示例11: test_group_status
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
def test_group_status(self):
"""
Should return True if user.groups contains the group specified and
False if it does not.
"""
user = UserFactory()
user.groups.all().delete()
for group in Group.objects.all():
# Makes a list of all group names, excluding the one that the
# user will be a member of
names = map(lambda group: group.name,
Group.objects.filter(~Q(name=group.name)))
user.groups.add(group.pk)
user.save()
for name in names:
self.assertFalse(User.objects.is_group_member(user, name))
self.assertTrue(User.objects.is_group_member(user, group.name))
user.groups.all().delete()
示例12: MyJobsViewsTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
#.........这里部分代码省略.........
resp = self.client.post(reverse('edit_account')+'?password',
data={'password': '[email protected]',
'new_password1': 'Secret',
'new_password2': 'Secret'}, follow=True)
errors = {'new_password1': [
u'Invalid Length (Must be 8 characters or more)',
u'Based on a common sequence of characters',
u'Must be more complex (Must contain 1 or more digits)']}
response_errors = resp.context['password_form'].errors
self.assertItemsEqual(response_errors, errors)
def test_password_without_punctuation_failure(self):
resp = self.client.post(reverse('edit_account')+'?password',
data={'password': '[email protected]',
'new_password1': 'S3cr37',
'new_password2': 'S3cr37'}, follow=True)
errors = {'new_password1': [
u'Invalid Length (Must be 8 characters or more)',
u'Based on a common sequence of characters',
u'Must be more complex (Must contain 1 or more punctuation '
u'character)']}
response_errors = resp.context['password_form'].errors
self.assertItemsEqual(response_errors, errors)
def test_partial_successful_profile_form(self):
resp = self.client.post(reverse('home'),
data={'name-given_name': 'Alice',
'name-family_name': 'Smith',
'name-primary': False,
'action': 'save_profile'}, follow=True)
self.assertEquals(resp.content, 'valid')
def test_complete_successful_profile_form(self):
# Form with only some sections completely filled out should
# save successfully
resp = self.client.post(
reverse('home'),
data={'name-given_name': 'Alice',
'name-family_name': 'Smith',
'edu-organization_name': 'Stanford University',
'edu-degree_date': '2012-01-01',
'edu-education_level_code': '6',
'edu-degree_major': 'Basket Weaving',
'work-position_title': 'Rocket Scientist',
'work-organization_name': 'Blamco Inc.',
'work-start_date': '2013-01-01',
'ph-use_code': 'Home',
'ph-area_dialing': '999',
'ph-number': '1234567',
'addr-address_line_one': '123 Easy St.',
'addr-city_name': 'Pleasantville',
'addr-country_sub_division_code': 'IN',
'addr-country_code': 'USA',
'addr-postal_code': '99999',
'action': 'save_profile'},
follow=True)
self.assertEquals(resp.content, 'valid')
def test_incomplete_profile_form(self):
# Form with incomplete sections should return a page with "This field
示例13: SavedSearchHelperTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
#.........这里部分代码省略.........
is_in_range = date_in_range(start, end, x)
self.assertTrue(is_in_range)
start = datetime.date(month=1, day=1, year=2013)
end = datetime.date(month=12, day=1, year=2013)
x = datetime.date(month=6, day=1, year=2010)
is_in_range = date_in_range(start, end, x)
self.assertFalse(is_in_range)
def test_parse_feed(self):
feed_url = 'http://www.my.jobs/feed/rss'
for use_json, count in [(True, 2), (False, 1)]:
items = parse_feed(feed_url, use_json=use_json)
# The second value in the items list is the total count from a
# feed, which may not equal the number of items returned
self.assertEqual(items[1], len(items[0]))
item = items[0][0]
for element in ['pubdate', 'title', 'description', 'link']:
self.assertTrue(item[element])
def test_parse_feed_with_count(self):
feed_url = 'http://www.my.jobs/feed/rss'
num_items = 1
items, count = parse_feed(feed_url, num_items=num_items)
self.assertEqual(count, num_items)
def test_url_sort_options(self):
feed = 'http://www.my.jobs/jobs/feed/rss?date_sort=False'
# Test to make sure sort by "Relevance" has '&date_sort=False' added
# a single time
feed_url = url_sort_options(feed, "Relevance")
parsed = urlparse(feed_url)
query = parse_qs(parsed.query)
self.assertEquals(parsed.path, "/jobs/feed/rss")
self.assertEquals(query['date_sort'], [u'False'])
# If a frequency isn't specified, days_ago should be missing from
# the url.
self.assertNotIn('days_ago', query)
# Test to make sure sort by "Date" doesn't have anything added
feed_url = url_sort_options(feed, "Date")
self.assertEquals(feed_url, "http://www.my.jobs/jobs/feed/rss")
# Test to make sure that passing in a frequency does in fact
# add the frequency to the feed url.
feed_url = url_sort_options(feed, "Relevance", frequency='D')
query = parse_qs(urlparse(feed_url).query)
self.assertEquals(query['days_ago'][0], '1')
feed_url = url_sort_options(feed, "Relevance", frequency='W')
query = parse_qs(urlparse(feed_url).query)
self.assertEquals(query['days_ago'][0], '7')
feed_url = url_sort_options(feed, "Relevance", frequency='M')
query = parse_qs(urlparse(feed_url).query)
self.assertEqual(query['days_ago'][0], '30')
def test_unicode_in_search(self):
search = SavedSearch(url=u"http://www.my.jobs/search?q=%E2%80%93",
user=self.user,
feed=u"http://www.my.jobs/search/feed/rss?q=%E2%80%93",
sort_by=u'Relevance')
search.save()
feed_url = url_sort_options(search.feed, search.sort_by)
old = parse_qs(urlparse(search.feed).query)
new = parse_qs(urlparse(feed_url).query)
self.assertFalse(old.get('date_sort'))
self.assertTrue(new['date_sort'][0])
del new['date_sort']
self.assertEqual(new, old)
def test_feed_on_protected_site_no_access(self):
from mydashboard.tests.factories import SeoSiteFactory
site_id = settings.PROTECTED_SITES.keys()[0]
site = SeoSiteFactory(pk=site_id, id=site_id)
url = "http://%s?q=query" % site.domain
result = update_url_if_protected(url, self.user)
self.assertEqual(result, url)
def test_feed_on_protected_site_with_access(self):
from mydashboard.tests.factories import SeoSiteFactory
site_id = settings.PROTECTED_SITES.keys()[0]
site = SeoSiteFactory(pk=site_id, id=site_id)
group_id = settings.PROTECTED_SITES.values()[0][0]
Group.objects.create(pk=group_id, name='Test Group')
self.user.groups.add(group_id)
self.user.save()
url = "http://%s?q=query" % site.domain
expected_result = "%s&key=%s" % (url, settings.SEARCH_API_KEY)
result = update_url_if_protected(url, self.user)
self.assertEqual(result, expected_result)
示例14: MyDashboardViewsTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
#.........这里部分代码省略.........
if type_ == 'home':
analytics_dict = home_dict
elif type_ == 'listing':
analytics_dict = view_dict
elif type_ == 'results':
analytics_dict = search_dict
else:
analytics_dict = apply_dict
analytics_dict.update(base_dict)
for _ in range(num_to_add):
dicts.append(analytics_dict.copy())
for analytics_dict in dicts:
analytics_dict['aguid'] = uuid.uuid4().hex
analytics_dict['uid'] = 'analytics##%s#%s' % (
analytics_dict['view_date'],
analytics_dict['aguid']
)
for location in settings.TEST_SOLR_INSTANCE.values():
solr = pysolr.Solr(location)
solr.add(dicts)
@unittest.skip("Correct behavior undefined with respect to duplicates.")
def test_number_of_searches_and_users_is_correct(self):
response = self.client.post(
reverse('dashboard')+'?company='+str(self.company.id))
# 6 users total
self.assertEqual(response.context['total_candidates'], 6)
old_search = SavedSearch.objects.all()[0]
old_search.created_on -= timedelta(days=31)
old_search.save()
response = self.client.post(
reverse('dashboard')+'?company='+str(self.company.id),
{'microsite': 'test.jobs'})
self.assertEqual(response.context['total_candidates'], 6)
def test_facets(self):
education = EducationFactory(user=self.candidate_user)
adr = AddressFactory(user=self.candidate_user)
license = LicenseFactory(user=self.candidate_user)
self.candidate_user.save()
update_solr_task(settings.TEST_SOLR_INSTANCE)
base_url = 'http://testserver/candidates/view?company={company}'
country_str = base_url + '&location={country}'
education_str = base_url + '&education={education}'
license_str = base_url + '&license={license_name}'
country_str = country_str.format(
company=self.company.pk, country=adr.country_code)
education_str = education_str.format(
company=self.company.pk, education=education.education_level_code)
license_str = license_str.format(
company=self.company.pk, license_name=license.license_name)
q = '?company={company}'
q = q.format(company=str(self.company.id))
response = self.client.post(reverse('dashboard')+q)
soup = BeautifulSoup(response.content)
types = ['Country', 'Education', 'License']
示例15: MyJobsAdminTests
# 需要导入模块: from myjobs.tests.factories import UserFactory [as 别名]
# 或者: from myjobs.tests.factories.UserFactory import save [as 别名]
class MyJobsAdminTests(MyJobsBase):
def setUp(self):
super(MyJobsAdminTests, self).setUp()
self.user.set_password('[email protected]')
self.user.is_superuser = True
self.user.save()
self.account_owner = UserFactory(email='[email protected]')
SeoSiteFactory(domain='secure.my.jobs')
mail.outbox = []
self.data = {'_selected_action': [unicode(self.account_owner.pk)],
'action': 'request_account_access'}
def test_request_access_to_staff(self):
"""
Requesting access to a staff/superuser account is not allowed.
"""
self.account_owner.is_staff = True
self.account_owner.save()
# Selecting the action in the User changelist and pressing "OK" should
# immediately show a notification at the top of the page.
response = self.client.post(
reverse('admin:myjobs_user_changelist'),
self.data, follow=True)
self.assertEqual(len(mail.outbox), 0)
self.assertContains(response, ("Requesting access to staff or "
"superusers is not supported."))
# Manually constructing a post to the relevant url should redirect
# to the User changelist and not send notification emails.
response = self.client.post(
reverse('request-account-access',
kwargs={'uid': self.account_owner.pk}),
{'reason': 'reason here'})
self.assertRedirects(response, reverse('admin:myjobs_user_changelist'))
self.assertEqual(len(mail.outbox), 0)
def test_request_access_to_non_staff(self):
"""
Requesting access to a non-staff/superuser account succeeds if the
target is not a staff/superuser account and the requesting staff
member provides a reason.
"""
# Request access to an account to get to the request form.
response = self.client.post(
reverse('admin:myjobs_user_changelist'),
self.data, follow=True)
self.assertContains(response, "What is the nature of this request?",
msg_prefix="Did not redirect to the request form")
url = reverse('request-account-access',
kwargs={'uid': self.account_owner.pk})
last_redirect = response.redirect_chain[-1][0]
# If the admin action determines that it is valid, it redirects. Ensure
# we redirected to the expected location.
self.assertTrue(last_redirect.endswith(url),
msg="Did not redirect as expected")
# Try submitting the request form without a reason.
response = self.client.post(url)
self.assertContains(response, "This field is required.",
msg_prefix=("Form error not present on invalid "
"submission"))
self.assertEqual(len(mail.outbox), 0,
msg="Mail sent despite form errors")
# # Submit again, providing a reason.
self.client.post(url, {'reason': 'reason here'})
self.assertEqual(len(mail.outbox), 1,
msg="Mail did not send on successful form submission")
email = mail.outbox[0]
self.assertTrue(self.account_owner.email in email.to,
msg="Email was sent to the wrong user")
self.assertTrue('reason here' in email.body,
msg="Account access reason was not in the sent email")
def test_export_as_csv_admin_action(self):
"""
Tests the ability to export the list of destination manipulations as a
CSV.
"""
email = '[email protected]'
password = 'password'
UserFactory(
email=email, password=password, is_staff=True, is_superuser=True)
# only superusers are allowed to use Django amin
self.client.login(username=email, password=password)
manipulations = [DestinationManipulationFactory(view_source=i)
for i in range(200, 210)]
# this is the format we expect results to be in if deserializing CSV
# into a list of dicts
formatted_manipulations = [{
u'View Source': unicode(m.view_source),
u'View Source Name': '',
u'BUID': unicode(m.buid),
u'Action Type': unicode(m.action_type),
#.........这里部分代码省略.........