コード例 #1
0
ファイル: tests.py プロジェクト: maykinmedia/Impostor
    def test_form(self):
        initial = { 'username': user_username, 'password': user_pass}
        form = BigAuthenticationForm(data=initial)
        self.assertTrue(form.is_valid())
        self.failUnlessEqual(form.cleaned_data['username'], user_username)
        self.failUnlessEqual(form.cleaned_data['password'], user_pass)

        new_uname = "%s as %s" % (real_admin_username, user_username) # Longer than contrib.auth default of 30 chars
        initial = { 'username': new_uname, 'password': real_admin_pass }
        form = BigAuthenticationForm(data=initial)
        self.assertTrue(form.is_valid())
        self.failUnlessEqual(form.cleaned_data['username'], new_uname)
        self.failUnlessEqual(form.cleaned_data['password'], real_admin_pass)

        del initial['password']
        form = BigAuthenticationForm(data=initial)
        self.assertFalse(form.is_valid())
コード例 #2
0
ファイル: tests.py プロジェクト: 360youlun/Impostor
	def test_form(self):
		initial = { 'username': user_username, 'password': user_pass}
		form = BigAuthenticationForm(data=initial)
		self.assertTrue(form.is_valid())
		self.failUnlessEqual(form.cleaned_data['username'], user_username)
		self.failUnlessEqual(form.cleaned_data['password'], user_pass)

		new_uname = "%s as %s" % (admin_username, user_username) # Longer than contrib.auth default of 30 chars
		initial = { 'username': new_uname, 'password': admin_pass }
		form = BigAuthenticationForm(data=initial)
		self.assertTrue(form.is_valid())
		self.failUnlessEqual(form.cleaned_data['username'], new_uname)
		self.failUnlessEqual(form.cleaned_data['password'], admin_pass)

		del initial['password']
		form = BigAuthenticationForm(data=initial)
		self.assertFalse(form.is_valid())