| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ | 2 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
| 6 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
| 7 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
| 8 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 9 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 10 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 key.set_metadata('Content-md5', 'XmUKnus7svY1frWsVskxXg==') | 394 key.set_metadata('Content-md5', 'XmUKnus7svY1frWsVskxXg==') |
| 395 key.set_contents_from_string('{"abc": 123}') | 395 key.set_contents_from_string('{"abc": 123}') |
| 396 | 396 |
| 397 check = self.bucket.get_key('test_header_case') | 397 check = self.bucket.get_key('test_header_case') |
| 398 self.assertEqual(check.content_type, 'application/json') | 398 self.assertEqual(check.content_type, 'application/json') |
| 399 | 399 |
| 400 def test_header_encoding(self): | 400 def test_header_encoding(self): |
| 401 key = self.bucket.new_key('test_header_encoding') | 401 key = self.bucket.new_key('test_header_encoding') |
| 402 | 402 |
| 403 key.set_metadata('Cache-control', 'public, max-age=500') | 403 key.set_metadata('Cache-control', 'public, max-age=500') |
| 404 key.set_metadata('Test-Plus', u'A plus (+)') |
| 404 key.set_metadata('Content-disposition', u'filename=Schöne Zeit.txt') | 405 key.set_metadata('Content-disposition', u'filename=Schöne Zeit.txt') |
| 405 key.set_contents_from_string('foo') | 406 key.set_contents_from_string('foo') |
| 406 | 407 |
| 407 check = self.bucket.get_key('test_header_encoding') | 408 check = self.bucket.get_key('test_header_encoding') |
| 408 | 409 |
| 409 self.assertEqual(check.cache_control, 'public, max-age=500') | 410 self.assertEqual(check.cache_control, 'public, max-age=500') |
| 410 self.assertEqual(check.content_disposition, 'filename=Sch%C3%B6ne+Zeit.t
xt') | 411 self.assertEqual(check.get_metadata('test-plus'), 'A plus (+)') |
| 412 self.assertEqual(check.content_disposition, 'filename=Sch%C3%B6ne%20Zeit
.txt') |
| 411 self.assertEqual( | 413 self.assertEqual( |
| 412 urllib.unquote_plus(check.content_disposition).decode('utf-8'), | 414 urllib.unquote(check.content_disposition).decode('utf-8'), |
| 413 'filename=Schöne Zeit.txt'.decode('utf-8') | 415 'filename=Schöne Zeit.txt'.decode('utf-8') |
| 414 ) | 416 ) |
| OLD | NEW |