From 2c2f55fd63e4096580f4d56279c261cedb1be1a9 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Fri, 11 Oct 2019 22:43:20 +0200 Subject: Fix test to not use the mention fixture --- .../test_notifications_dismiss.yaml | 136 ++++++++++++++++----- tests/test_notifications.py | 12 +- 2 files changed, 116 insertions(+), 32 deletions(-) (limited to 'tests') diff --git a/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml b/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml index 0a5cf03..466ee25 100644 --- a/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml +++ b/tests/cassettes_pre_2_9_2/test_notifications_dismiss.yaml @@ -1,4 +1,44 @@ interactions: +- request: + body: status=%40mastodonpy_test+hello%21 + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2] + Connection: [keep-alive] + Content-Length: ['34'] + Content-Type: [application/x-www-form-urlencoded] + User-Agent: [python-requests/2.18.4] + method: POST + uri: http://localhost:3000/api/v1/statuses + response: + body: + string: !!binary | + H4sIAFTpoF0AA5RU246bMBD9ldTPTTDktiBV2h/o2z61qdDEOODW2BY22UbR/nvHYBKSoKz6hOfM + nBmP5wxnIgqSkZgm6Wq9Sel2u07jOE1T8pWwhoPjRQ4OIxIap/OYzuP4LaHZaplRulhtVz8wTqi8 + 4Uaecqdzn021Ut6iwJhulRt5LVdWOHHkJDuAtBwRo4XkTe74X18P8x6FFXshhTuhbdq9FAxRCaps + oUQi4QrtthF4rJwzWRRJzUBW2rqotbyxERS1UJF14NC20WSbbSOnErz23EmKb0xwm3ddkYx6ZC91 + OUYOcNR4N8cnweLSd88sR0jdjv1GKDUymVaO+2xk11K6ZKb78N6wBtSMSbD2245UcwZNsSPjAJhV + DT9450O7NVinC60MToxbtyOXRO0cn2hWY1Wh1ZDv9VqxB+75nTu6+gMAN9bVPau4lPpLwENXZHie + QTZg8OEZ+IuQ7EwU1F4H30PphTnNfO2ZbfGJkfzO99afOvYH0lkYxTnI3o8fhRLydBMnXZgbmYWw + RsIpD1Feg5r9Gc1kr911Pg9LQzfzJHmLk2yVZGu6oOnGL43S/l5TQxw1/1Sa/qJHcNBMhfQeG+lG + lEKBjGphrVDlwqjyQsz9YuBS/T+/4lDwycK95xPik8Kf8A8aVfKOAcNSJQOGMQMW498krPwlDJeP + 1/q3sCT7+Qs5gsuiO6Msal4IwIk5YJWXeYgJivfWoJdkif+C7UtK+9OtfO424Mn8HiOD5O4dH3gN + B2W40LgBv9vDVhh8gKDxfwAAAP//AwBP4Bk20AUAAA== + headers: + Cache-Control: ['no-cache, no-store'] + Content-Encoding: [gzip] + Content-Type: [application/json; charset=utf-8] + Referrer-Policy: [strict-origin-when-cross-origin] + Vary: ['Accept-Encoding, Origin'] + X-Content-Type-Options: [nosniff] + X-Download-Options: [noopen] + X-Frame-Options: [SAMEORIGIN] + X-Permitted-Cross-Domain-Policies: [none] + X-Request-Id: [c8f1a689-c9e4-484c-ac27-2e56b52323ce] + X-Runtime: ['0.316550'] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} - request: body: null headers: @@ -12,37 +52,37 @@ interactions: response: body: string: !!binary | - H4sIACbooF0AA+xZS4/iOBD+K9mcgTjOi2Q10lz3sLc57fQImcSAZxzbih260Yr/vuU8SHhMQ49G - q24pF4jLVbar/FXVF/j6r8sKN3P9ALsz1xwUhUFJhWFSgCCvKDG0WBEDYoz8dO6jue9/wSgLkixK - Fkka/gN6JM9lLUCpXw5ktaaVIKVdkBQlE62aGQ0LphUnh1WnBRIu8x8UFtgQrunMXUtzer4+Corn - GH/xcRbiLEILlMb2KEIau9hTjVCQq+aLtgOvG9mzVRx0dsaozPNgU8J3Uhvv8+mge2JIdUulndGe - rNiWCcK9kmnNxHahxPZkuNKGGJb/gv2OkoLe3LiduWP4ysZ37DeSc/kMCqvuJnEvA51e5s9cuwHc - 7KCGZi4t5Xem3ezrN7BhlBfN87FXHlCBcBpGc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['no-cache, no-store'] Content-Encoding: [gzip] Content-Type: [application/json; charset=utf-8] Link: ['; rel="next", - ; rel="prev"'] + ; rel="prev"'] Referrer-Policy: [strict-origin-when-cross-origin] Vary: ['Accept-Encoding, Origin'] X-Content-Type-Options: [nosniff] X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [c803dcde-b4b2-4c79-ad89-8bfd07ec57ae] - X-Runtime: ['0.150857'] + X-Request-Id: [7332ffde-9101-4a43-82b4-a4f0ecbce551] + X-Runtime: ['0.131203'] X-XSS-Protection: [1; mode=block] status: {code: 200, message: OK} - request: @@ -58,7 +98,7 @@ interactions: response: body: string: !!binary | - H4sIACbooF0AA0yQXU7EMAyE7+Ln0vRnabe5AydAqDKJaQNpEiXO7sNq705KWcSb/WlGM/YNcjQg + H4sIAFTpoF0AA0yQXU7EMAyE7+Ln0vRnabe5AydAqDKJaQNpEiXO7sNq705KWcSb/WlGM/YNcjQg wXqFdvWJoQI2bKmwF0zstXcFaUoqmsCmbBIKoA2NPcYLxXTwrp7qtpAcbQJ5g8SRcDNumTHsIdck hfhLkqemaeBeFRnyjz4nirPy2THI/uA5PUDXlhq+xLoHaYqX17y9u6PLyhz+B4iA6iuJjbRBYTZc KIkQ6WLo+jRhO+q++1Cncz9MdFZKT22D43M3NDSMuv4MS7nEolvybgT5CuTgrYJIiymH4f6Lgjlm @@ -67,20 +107,20 @@ interactions: Cache-Control: ['max-age=300, public'] Content-Encoding: [gzip] Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 11 Oct 2019 20:37:58 GMT'] - ETag: [W/"ad87f54668db431e5bc3f918c2e6980a"] + Date: ['Fri, 11 Oct 2019 20:43:00 GMT'] + ETag: [W/"ad29a128469658ac7b93b5ec01dbc18f"] Referrer-Policy: [strict-origin-when-cross-origin] Vary: ['Accept-Encoding, Origin'] X-Content-Type-Options: [nosniff] X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [c6e9a6fe-e6c0-4fb4-be3f-c946b3c7ab32] - X-Runtime: ['0.028744'] + X-Request-Id: [59964f41-6806-4a96-9a09-5ba735eecb3f] + X-Runtime: ['0.030156'] X-XSS-Protection: [1; mode=block] status: {code: 200, message: OK} - request: - body: id=132 + body: id=134 headers: Accept: ['*/*'] Accept-Encoding: ['gzip, deflate'] @@ -94,7 +134,45 @@ interactions: response: body: string: !!binary | - H4sIACbooF0AA6quBQAAAP//AwBDv6ajAgAAAA== + H4sIAFTpoF0AA6quBQAAAP//AwBDv6ajAgAAAA== + headers: + Cache-Control: ['no-cache, no-store'] + Content-Encoding: [gzip] + Content-Type: [application/json; charset=utf-8] + Referrer-Policy: [strict-origin-when-cross-origin] + Vary: ['Accept-Encoding, Origin'] + X-Content-Type-Options: [nosniff] + X-Download-Options: [noopen] + X-Frame-Options: [SAMEORIGIN] + X-Permitted-Cross-Domain-Policies: [none] + X-Request-Id: [9093e35a-5e86-4974-b423-90e9268c082c] + X-Runtime: ['0.026793'] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2] + Connection: [keep-alive] + Content-Length: ['0'] + User-Agent: [python-requests/2.18.4] + method: DELETE + uri: http://localhost:3000/api/v1/statuses/102945690775911999 + response: + body: + string: !!binary | + H4sIAFXpoF0AA5RU23KbMBD9lVTPtRH4FnjKD/QtT70MsxYybCskDRJOPZ78e1cgPCRh4ukTezln + tbs64sqwYgVLeZZvd/ucHw67PE3zPGdfmegkeFmV4AmR8TRfpXyVps8ZL7abgvP19rD9TjjUZSet + upTelKGa7pV6GwUhTK/9LOukdujxLFlxAuUkRaxBJbvSy7/hPKp7RodHVOgv5Nv+qFBQVIGue6iJ + yKQmv++QzMZ7WySJMgJUY5xPeic7l0DVok6cB0++SxbH7Du1VOBp5C5SwmAoXTlMxQoeIkdl6nnk + BGdDvXm5GKxuc4/MehZp+3neotYzN67nqQXnTWW0pQVL5x8aqZT5wqZ6057BUqcCPBrNiivT0IbF + fYvktb08DGzXU09EfpFHF6yB/Up0EXu/Rp2EfdFmY51hRWyA+ZlbobMKLmVEhUsz4s9siKPxN/uj + yvh+lWXPaVZss2LH1zzfB5VpE/piP3vON8IOHzk6SfTu3WVo9AweuiXImHGJ6bBGDSpp0TnU9drq + +kYsg5JIhf/PbyRUcvHgMXOH+MnBd/gnQ7p4IcCkwmyKEWaKpfT84hu5wUitsjW/0bHixy/ioFTV + YJMsWlkh0I15EE0rtY+YYJLQgjfpJdvQ4zk85ny03srnnYY/ub+PyCi594lXasNDHRuaDyCgu/19 + LC0gavwfAAAA//8DAPavAQgBBQAA headers: Cache-Control: ['no-cache, no-store'] Content-Encoding: [gzip] @@ -105,8 +183,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [4a767314-d1c1-4872-a9e1-fc3186b4b2a1] - X-Runtime: ['0.031584'] + X-Request-Id: [09583968-dd77-4f00-9afe-4803a55d4157] + X-Runtime: ['0.083699'] X-XSS-Protection: [1; mode=block] status: {code: 200, message: OK} version: 1 diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 3032519..ab9ac31 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py @@ -17,10 +17,16 @@ def test_notifications_dismiss(api, mention): notifications = api.notifications() api.notifications_dismiss(notifications[0]) # TODO possibly verify that this returns a notif dict -def test_notifications_dismiss_pre_2_9_2(api, mention): +def test_notifications_dismiss_pre_2_9_2(api, api2): with vcr.use_cassette('test_notifications_dismiss.yaml', cassette_library_dir='tests/cassettes_pre_2_9_2', record_mode='none'): - notifications = api.notifications() - api.notifications_dismiss(notifications[0]) + status = None + try: + status = api2.status_post('@mastodonpy_test hello!') + notifications = api.notifications() + api.notifications_dismiss(notifications[0]) + finally: + if not status is None: + api2.status_delete(status) @pytest.mark.vcr() def test_notifications_clear(api): -- cgit v1.2.3