本文整理汇总了Python中accounts.models.Account.register方法的典型用法代码示例。如果您正苦于以下问题:Python Account.register方法的具体用法?Python Account.register怎么用?Python Account.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accounts.models.Account
的用法示例。
在下文中一共展示了Account.register方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
PlotTest.files = []
# used for tests that use fake requests
self.client = Client()
Account.register("brobot2", "[email protected]", "password", "password")
self.account_id = Account.objects.get(username="brobot2").id
self.client.login(username="brobot2", password="password")
示例2: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
self.client = Client()
Account.register("bobthebuilder", "[email protected]", "password", "password")
self.client.login(username="bobthebuilder", password="password")
self.account_id = Account.objects.get(username="bobthebuilder").id
self.file_dir = os.path.join(settings.MEDIA_ROOT, files.models.rel_local_file_dir(self.account_id))
if not os.path.isdir(self.file_dir):
os.makedirs(self.file_dir)
示例3: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
self.client = Client()
Account.register(HistogramTest.username, "[email protected]", "password", "password")
self.account_id = Account.objects.get(username="foo").id
self.client.login(username="foo", password="password")
self.title = 'HISTOGRAM TEST TITLE'
self.file_dir = os.path.join(settings.MEDIA_ROOT, files.models.rel_local_file_dir(self.account_id))
if not os.path.isdir(self.file_dir):
os.makedirs(self.file_dir)
示例4: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
django.setup()
self.client = Client()
Account.register(FilesTest.username, "[email protected]", "password", "password")
self.account_id = Account.objects.get(username="brobot").id
self.client.login(username="brobot", password="password")
self.file_dir = os.path.join(settings.MEDIA_ROOT, files.models.rel_local_file_dir(self.account_id))
if not os.path.isdir(self.file_dir):
os.makedirs(self.file_dir)
示例5: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
self.client1 = Client()
self.client2 = Client()
Account.register(PermissionsTest.user1Name, "[email protected]", "password", "password")
self.account_id_one = Account.objects.get(username=PermissionsTest.user1Name).id
self.client1.login(username=PermissionsTest.user1Name, password='password')
Account.register(PermissionsTest.user2Name, "[email protected]", "password", "password")
self.account_id_two = Account.objects.get(username=PermissionsTest.user2Name).id
self.client2.login(username=PermissionsTest.user2Name, password="password")
self.file_dir_one = os.path.join(settings.MEDIA_ROOT, files.models.rel_local_file_dir(self.account_id_one))
self.file_dir_two = os.path.join(settings.MEDIA_ROOT, files.models.rel_local_file_dir(self.account_id_two))
if not os.path.isdir(self.file_dir_one) and not os.path.isdir(self.file_dir_two):
os.makedirs(self.file_dir)
self.createPanePlot()
示例6: testCheckSession
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def testCheckSession(self):
# cursor = connection.cursor()
# cursor.execute(""" DELETE (*) FROM django_session """)
self.account = Account.register("test232", "[email protected]", "testpwd", "testpwd")
# cursor.execute('SELECT * FROM accounts_account')
# val = cursor.fetchall()
accounts = Account.objects.all()
# Check user name in format <Account: TEST>
self.assertEqual(accounts[1].username, "test232")
self.assertEqual(accounts[0].username, "test")
self.assertEqual(accounts[1].email, "[email protected]")
示例7: testMatchingPwd
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def testMatchingPwd(self):
r = Account.register("test5", "[email protected]", "testpwd", "test123")
self.assertEqual(r, {Account.FAIL: {Account.NON_MATCHING_PASSWORD: Account.errors[Account.NON_MATCHING_PASSWORD]}})
示例8: testcreatenewSuccess
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def testcreatenewSuccess(self):
# request = self.factory.get("/api/accounts/")
n = Account.register("test2", "[email protected]", "testpwd", "testpwd")
self.assertEqual(n.keys()[0], Account.SUCCESS)
示例9: testDuplicateSignup
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def testDuplicateSignup(self):
# Statuses should be 1 and 2
register = Account.register("test", "[email protected]", "testpwd", "testpwd")
self.assertEqual(register, {Account.FAIL: {Account.USERNAME_EXISTS:Account.errors[Account.USERNAME_EXISTS],
Account.EMAIL_EXISTS: Account.errors[Account.EMAIL_EXISTS]}})
示例10: setUp
# 需要导入模块: from accounts.models import Account [as 别名]
# 或者: from accounts.models.Account import register [as 别名]
def setUp(self):
self.factory = RequestFactory()
self.account = Account.register("test", "[email protected]", "testpwd", "testpwd")