Skip to content

Commit

Permalink
Add a test for cache status with a quick load
Browse files Browse the repository at this point in the history
  • Loading branch information
BelKed committed Aug 25, 2022
1 parent 6e67e6e commit cd51a3e
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
129 changes: 129 additions & 0 deletions test/cassettes/cache_status_enabled_load_quick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"http_interactions": [
{
"recorded_at": "2022-08-25T19:41:18",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
"Accept": [
"*/*"
],
"Accept-Encoding": [
"gzip, deflate"
],
"Connection": [
"keep-alive"
],
"User-Agent": [
"python-requests/2.28.1"
]
},
"method": "GET",
"uri": "http://tiles01.geocaching.com/map.details?i=GC8CKQQ"
},
"response": {
"body": {
"encoding": null,
"string": ""
},
"headers": {
"Connection": [
"Keep-Alive"
],
"Content-Length": [
"0"
],
"Location": [
"https://tiles01.geocaching.com/map.details?i=GC8CKQQ"
],
"Server": [
"BigIP"
]
},
"status": {
"code": 302,
"message": "Moved Temporarily"
},
"url": "http://tiles01.geocaching.com/map.details?i=GC8CKQQ"
}
},
{
"recorded_at": "2022-08-25T19:41:19",
"request": {
"body": {
"encoding": "utf-8",
"string": ""
},
"headers": {
"Accept": [
"*/*"
],
"Accept-Encoding": [
"gzip, deflate"
],
"Connection": [
"keep-alive"
],
"Cookie": [
"gspkauth=<AUTH COOKIE>"
],
"User-Agent": [
"python-requests/2.28.1"
]
},
"method": "GET",
"uri": "https://tiles01.geocaching.com/map.details?i=GC8CKQQ"
},
"response": {
"body": {
"encoding": "UTF-8",
"string": "{\"status\":\"success\",\"data\":[{\"name\":\"Kohinoorka\",\"gc\":\"GC8CKQQ\",\"g\":\"0a786802-1a56-4c25-b52e-51e064ada861\",\"available\":true,\"archived\":false,\"subrOnly\":false,\"li\":false,\"fp\":\"15\",\"difficulty\":{\"text\":2.0,\"value\":\"2\"},\"terrain\":{\"text\":2.0,\"value\":\"2\"},\"hidden\":\"8/24/2019\",\"container\":{\"text\":\"Small\",\"value\":\"small.gif\"},\"type\":{\"text\":\"Traditional Cache\",\"value\":2},\"owner\":{\"text\":\"haj\u00edci\",\"value\":\"d9b10451-f71d-4d5a-be1d-7864fa92fdf0\"}}]}"
},
"headers": {
"Cache-Control": [
"no-cache"
],
"Content-Length": [
"444"
],
"Content-Type": [
"application/json; charset=UTF-8"
],
"Date": [
"Thu, 25 Aug 2022 19:41:19 GMT"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"Vary": [
"Accept-Encoding"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-Frame-Options": [
"SAMEORIGIN"
],
"X-XSS-Protection": [
"1"
]
},
"status": {
"code": 200,
"message": "OK"
},
"url": "https://tiles01.geocaching.com/map.details?i=GC8CKQQ"
}
}
],
"recorded_with": "betamax/0.8.1"
}
6 changes: 6 additions & 0 deletions test/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,9 @@ def test_cache_status(self):
cache = Cache(self.gc, "GC10")
with self.recorder.use_cassette("cache_status_locked"):
self.assertEqual(Status.locked, cache.status)

with self.subTest("Enabled > Quick load"):
cache = Cache(self.gc, "GC8CKQQ")
with self.recorder.use_cassette("cache_status_enabled_load_quick"):
cache.load_quick()
self.assertEqual(Status.enabled, cache.status)

0 comments on commit cd51a3e

Please sign in to comment.