Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/s3/test_website_command.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License"). You
5
# may not use this file except in compliance with the License. A copy of
6
# the License is located at
7
#
8
# http://aws.amazon.com/apache2.0/
9
#
10
# or in the "license" file accompanying this file. This file is
11
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
# ANY KIND, either express or implied. See the License for the specific
13
# language governing permissions and limitations under the License.
14
from awscli.testutils import BaseAWSCommandParamsTest
15
import re
16
17
18
class TestWebsiteCommand(BaseAWSCommandParamsTest):
19
20
prefix = 's3 website '
21
22
def test_index_document(self):
23
cmdline = self.prefix + 's3://mybucket --index-document index.html'
24
result = {
25
'WebsiteConfiguration':
26
{'IndexDocument': {'Suffix': 'index.html'}},
27
'Bucket': u'mybucket'}
28
29
self.assert_params_for_cmd(cmdline, result)
30
31
def test_error_document(self):
32
cmdline = self.prefix + 's3://mybucket --error-document mykey'
33
result = {
34
'WebsiteConfiguration': {
35
'ErrorDocument': {'Key': 'mykey'}}, 'Bucket': u'mybucket'}
36
self.assert_params_for_cmd(cmdline, result)
37
38
39
if __name__ == "__main__":
40
unittest.main()
41
42