3
Test that a version 1 POP3UID is unchanged by the upgrade except that it gains a
4
value for the new C{retrieved} attribute set to something near the current time.
7
from epsilon.extime import Time
9
from axiom.userbase import LoginSystem
10
from axiom.test.historic.stubloader import StubbedTest
12
from xquotient.test.historic.stub_pop3uid1to2 import VALUE, FAILED, GRABBER_ID
13
from xquotient.grabber import POP3UID
15
class POP3UIDUpgradeTestCase(StubbedTest):
16
def test_attributes(self):
17
loginSystem = self.store.findUnique(LoginSystem)
18
account = loginSystem.accountByAddress(u'testuser', u'localhost')
19
subStore = account.avatars.open()
21
d = subStore.whenFullyUpgraded()
22
def upgraded(ignored):
23
[pop3uid] = list(subStore.query(POP3UID))
24
self.assertEqual(VALUE, pop3uid.value)
25
self.assertEqual(FAILED, pop3uid.failed)
26
self.assertEqual(GRABBER_ID, pop3uid.grabberID)
28
# This will be close enough.
29
elapsed = (Time() - pop3uid.retrieved).total_seconds()
30
self.assertTrue(abs(elapsed) < 60)
31
d.addCallback(upgraded)