diff options
Diffstat (limited to 'tests/setup_app.sql')
-rw-r--r-- | tests/setup_app.sql | 103 |
1 files changed, 75 insertions, 28 deletions
diff --git a/tests/setup_app.sql b/tests/setup_app.sql index 6239eb3..81f1e18 100644 --- a/tests/setup_app.sql +++ b/tests/setup_app.sql | |||
@@ -1,37 +1,84 @@ | |||
1 | WITH new_app AS ( | 1 | DELETE FROM oauth_access_tokens WHERE id = 6543210987654321; |
2 | INSERT INTO oauth_applications ( | 2 | DELETE FROM oauth_access_tokens WHERE id = 1234567890123456; |
3 | name, | 3 | DELETE FROM oauth_applications WHERE id = 1234567890123456; |
4 | uid, | 4 | DELETE FROM users WHERE id = 1234567890123456; |
5 | secret, | 5 | DELETE FROM accounts WHERE id = 1234567890123456; |
6 | redirect_uri, | 6 | |
7 | scopes, | 7 | INSERT INTO accounts ( |
8 | owner_type, | 8 | id, |
9 | owner_id, | 9 | username, |
10 | created_at, | 10 | created_at, |
11 | updated_at | 11 | updated_at |
12 | ) VALUES ( | 12 | ) VALUES ( |
13 | 'Mastodon.py test suite', | 13 | 1234567890123456, |
14 | '__MASTODON_PY_TEST_ID', | 14 | 'mastodonpy_test', |
15 | '__MASTODON_PY_TEST_SECRET', | 15 | now(), |
16 | 'urn:ietf:wg:oauth:2.0:oob', | 16 | now() |
17 | 'read write follow', | 17 | ); |
18 | 'User', | 18 | |
19 | 1, | 19 | INSERT INTO users ( |
20 | now(), | 20 | id, |
21 | now() | 21 | email, |
22 | ) | 22 | account_id, |
23 | RETURNING id | 23 | created_at, |
24 | ) | 24 | updated_at, |
25 | confirmed_at, | ||
26 | locale | ||
27 | ) VALUES ( | ||
28 | 1234567890123456, | ||
29 | 'mastodonpy_test@localhost:3000', | ||
30 | 1234567890123456, | ||
31 | now(), | ||
32 | now(), | ||
33 | now(), | ||
34 | 'ja' -- japanese locale for unicode testing :p | ||
35 | ); | ||
36 | |||
37 | |||
38 | |||
39 | INSERT INTO oauth_applications ( | ||
40 | id, | ||
41 | name, | ||
42 | uid, | ||
43 | secret, | ||
44 | redirect_uri, | ||
45 | scopes, | ||
46 | owner_type, | ||
47 | owner_id, | ||
48 | created_at, | ||
49 | updated_at | ||
50 | ) VALUES ( | ||
51 | 1234567890123456, | ||
52 | 'Mastodon.py test suite', | ||
53 | '__MASTODON_PY_TEST_CLIENT_ID', | ||
54 | '__MASTODON_PY_TEST_CLIENT_SECRET', | ||
55 | 'urn:ietf:wg:oauth:2.0:oob', | ||
56 | 'read write follow', | ||
57 | 'User', | ||
58 | 1234567890123456, | ||
59 | now(), | ||
60 | now() | ||
61 | ); | ||
62 | |||
25 | INSERT INTO oauth_access_tokens ( | 63 | INSERT INTO oauth_access_tokens ( |
64 | id, | ||
26 | token, | 65 | token, |
27 | scopes, | 66 | scopes, |
28 | application_id, | 67 | application_id, |
29 | resource_owner_id, | 68 | resource_owner_id, |
30 | created_at | 69 | created_at |
31 | ) SELECT | 70 | ) VALUES ( |
32 | '__MASTODON_PY_TEST_TOKEN', | 71 | 1234567890123456, |
72 | '__MASTODON_PY_TEST_ACCESS_TOKEN', | ||
73 | 'read write follow', | ||
74 | 1234567890123456, | ||
75 | 1234567890123456, | ||
76 | now() | ||
77 | ), ( | ||
78 | 6543210987654321, | ||
79 | '__MASTODON_PY_TEST_ACCESS_TOKEN_2', | ||
33 | 'read write follow', | 80 | 'read write follow', |
34 | new_app.id, | 81 | 1234567890123456, |
35 | 1, | 82 | 1, |
36 | now() | 83 | now() |
37 | FROM new_app; | 84 | ); |