revert read_dev_agreement back to a bool

This commit is contained in:
Chris Van 2012-02-27 15:21:50 -08:00
Родитель 427c4506fb
Коммит 669c53b5ce
5 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -114,7 +114,7 @@ class UserProfile(amo.models.OnChangeMixin, amo.models.ModelBase):
resetcode_expires = models.DateTimeField(default=datetime.now, null=True,
blank=True)
sandboxshown = models.BooleanField(default=False)
read_dev_agreement = models.DateTimeField(null=True, blank=True)
read_dev_agreement = models.BooleanField(default=False)
last_login_ip = models.CharField(default='', max_length=45, editable=False)
last_login_attempt = models.DateTimeField(null=True, editable=False)

Просмотреть файл

@ -18,7 +18,8 @@ NO_EMAIL_PATTERNS = {
# re.compile(r'''OperationalError: (1205, 'Lock wait timeout '''
# '''exceeded; try restarting transaction')'''),
'ValidationError':
re.compile(r'Enter a valid date/time'),
re.compile(re.escape('Enter a valid date/time in YYYY-MM-DD '
'HH:MM[:ss[.uuuuuu]] format.')),
}
import logging

Просмотреть файл

@ -1,4 +1,5 @@
ALTER TABLE `users` CHANGE COLUMN
`read_dev_agreement` `read_dev_agreement` DATETIME;
UPDATE `users` SET `read_dev_agreement` = NULL
WHERE `read_dev_agreement` = '0000-00-00 00:00:00';
-- -dev was choking on this
-- ALTER TABLE `users` CHANGE COLUMN
-- `read_dev_agreement` `read_dev_agreement` DATETIME;
-- UPDATE `users` SET `read_dev_agreement` = NULL
-- WHERE `read_dev_agreement` = '0000-00-00 00:00:00';

Просмотреть файл

@ -0,0 +1,3 @@
-- Make this a bool until I figure out why -dev choked on this.
ALTER TABLE `users` CHANGE COLUMN
`read_dev_agreement` `read_dev_agreement` BOOL;

Просмотреть файл

@ -95,18 +95,20 @@ class TestTerms(TestSubmit):
def test_agree(self):
r = self.client.post(self.url, {'read_dev_agreement': True})
self.assertRedirects(r, reverse('submit.app.manifest'))
dt = self.get_user().read_dev_agreement
assert close_to_now(dt), (
'Expected date of agreement read to be close to now. Was %s' % dt)
#dt = self.get_user().read_dev_agreement
#assert close_to_now(dt), (
# 'Expected date of agreement read to be close to now. Was %s' % dt)
eq_(self.get_user().read_dev_agreement, True)
eq_(UserNotification.objects.count(), 0)
def test_agree_and_sign_me_up(self):
r = self.client.post(self.url, {'read_dev_agreement': True,
'newsletter': True})
self.assertRedirects(r, reverse('submit.app.manifest'))
dt = self.get_user().read_dev_agreement
assert close_to_now(dt), (
'Expected date of agreement read to be close to now. Was %s' % dt)
#dt = self.get_user().read_dev_agreement
#assert close_to_now(dt), (
# 'Expected date of agreement read to be close to now. Was %s' % dt)
eq_(self.get_user().read_dev_agreement, True)
eq_(UserNotification.objects.count(), 1)
notes = UserNotification.objects.filter(user=self.user, enabled=True,
notification_id=app_surveys.id)
@ -115,7 +117,7 @@ class TestTerms(TestSubmit):
def test_disagree(self):
r = self.client.post(self.url)
eq_(r.status_code, 200)
eq_(self.user.read_dev_agreement, None)
eq_(self.user.read_dev_agreement, False)
eq_(UserNotification.objects.count(), 0)
@ -127,7 +129,8 @@ class TestManifest(TestSubmit):
self.url = reverse('submit.app.manifest')
def _step(self):
self.user.update(read_dev_agreement=datetime.datetime.now())
#self.user.update(read_dev_agreement=datetime.datetime.now())
self.user.update(read_dev_agreement=True)
def test_anonymous(self):
self._test_anonymous()
@ -310,7 +313,8 @@ class TestDetails(TestSubmit):
return json.loads(rp.content)['upload_hash']
def _step(self):
self.user.update(read_dev_agreement=datetime.datetime.now())
#self.user.update(read_dev_agreement=datetime.datetime.now())
self.user.update(read_dev_agreement=True)
self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp,
terms=True, manifest=True)