Add activity push notifications and registration patches
This commit is contained in:
@@ -34,12 +34,16 @@ class FeatureApiTests(unittest.TestCase):
|
||||
with main.get_db_connection() as db:
|
||||
db.execute('''
|
||||
CREATE TABLE users(id SERIAL PRIMARY KEY, username TEXT UNIQUE, email TEXT UNIQUE,
|
||||
display_name TEXT, password_hash TEXT, is_admin BOOLEAN DEFAULT FALSE);
|
||||
display_name TEXT, password_hash TEXT, is_admin BOOLEAN DEFAULT FALSE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
|
||||
CREATE TABLE sessions(id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
||||
token_hash TEXT UNIQUE, expires_at TIMESTAMP);
|
||||
CREATE TABLE friendships(addressee_id INTEGER, status TEXT);
|
||||
CREATE TABLE direct_messages(recipient_id INTEGER, read_at TIMESTAMP);
|
||||
CREATE TABLE event_invitations(user_id INTEGER, viewed_at TIMESTAMP);
|
||||
CREATE TABLE user_badges(user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
||||
badge_code TEXT, awarded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(user_id,badge_code));
|
||||
''')
|
||||
for statement in FEATURE_SCHEMA: db.execute(statement)
|
||||
cls.password_hash = bcrypt.hashpw(b'Test-only-password-123', bcrypt.gensalt()).decode()
|
||||
@@ -81,7 +85,8 @@ class FeatureApiTests(unittest.TestCase):
|
||||
|
||||
def test_migrations_repeat_and_match_startup_schema(self):
|
||||
with main.get_db_connection() as db:
|
||||
for name, runtime in zip(('19_push_devices.sql', '20_bug_report_submissions.sql'), FEATURE_SCHEMA):
|
||||
for name, runtime in zip(('19_push_devices.sql', '20_bug_report_submissions.sql',
|
||||
'21_push_notifications.sql', '22_registration_badges.sql'), FEATURE_SCHEMA):
|
||||
source = Path('/test-migrations', name).read_text()
|
||||
normalize = lambda s: re.sub(r'\s+', '', re.sub(r'--[^\n]*', '', s))
|
||||
self.assertEqual(normalize(source), normalize(runtime))
|
||||
|
||||
Reference in New Issue
Block a user