|
7 | 7 | "context" |
8 | 8 | "crypto/md5" |
9 | 9 | "encoding/base64" |
| 10 | + "time" |
| 11 | + |
10 | 12 | "encoding/hex" |
11 | 13 | "fmt" |
12 | 14 | "io/ioutil" |
@@ -47,12 +49,18 @@ var ( |
47 | 49 | } |
48 | 50 |
|
49 | 51 | objectSingularDataSourceRepresentation = map[string]interface{}{ |
50 | | - "bucket": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.name}`}, |
51 | | - "namespace": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.namespace}`}, |
52 | | - "object": Representation{repType: Required, create: `my-test-object-3`}, |
53 | | - "content_length_limit": Representation{repType: Optional, create: `17`, update: `15`}, |
54 | | - "base64_encode_content": Representation{repType: Optional, create: `true`}, |
55 | | - "version_id": Representation{repType: Optional, create: `${oci_objectstorage_object.test_object.version_id}`}, |
| 52 | + "bucket": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.name}`}, |
| 53 | + "namespace": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.namespace}`}, |
| 54 | + "object": Representation{repType: Required, create: `my-test-object-3`}, |
| 55 | + "content_length_limit": Representation{repType: Optional, create: `17`, update: `20`}, |
| 56 | + "base64_encode_content": Representation{repType: Optional, create: `true`}, |
| 57 | + "version_id": Representation{repType: Optional, create: `${oci_objectstorage_object.test_object.version_id}`}, |
| 58 | + "http_response_cache_control": Representation{repType: Optional, create: `no-cache`, update: `no-store`}, |
| 59 | + "http_response_content_disposition": Representation{repType: Optional, create: `inline`, update: `inline`}, |
| 60 | + "http_response_content_encoding": Representation{repType: Optional, create: `identity`, update: `identity`}, |
| 61 | + "http_response_content_language": Representation{repType: Optional, create: `en-US`, update: `en-US`}, |
| 62 | + "http_response_content_type": Representation{repType: Optional, create: `text/plain`, update: `text/plain`}, |
| 63 | + "http_response_expires": Representation{repType: Optional, create: expirationTimeForPar.Format(time.RFC3339Nano), update: expirationTimeForPar.Format(time.RFC3339Nano)}, |
56 | 64 | } |
57 | 65 |
|
58 | 66 | objectRepresentation = map[string]interface{}{ |
@@ -288,16 +296,17 @@ func TestObjectStorageObjectResource_basic(t *testing.T) { |
288 | 296 | Config: config + compartmentIdVariableStr + ObjectResourceDependencies + |
289 | 297 | generateResourceFromRepresentationMap("oci_objectstorage_object", "test_object", Optional, Update, |
290 | 298 | getUpdatedRepresentationCopy("object", Representation{repType: Required, create: `my-test-object-1`, update: `my-test-object-3`}, objectRepresentation)) + |
291 | | - generateDataSourceFromRepresentationMap("oci_objectstorage_object", "test_object", Optional, Create, objectSingularDataSourceRepresentation), |
| 299 | + generateDataSourceFromRepresentationMap("oci_objectstorage_object", "test_object", Optional, Update, objectSingularDataSourceRepresentation), |
292 | 300 | Check: resource.ComposeAggregateTestCheckFunc( |
293 | 301 | resource.TestCheckResourceAttr(singularDatasourceName, "base64_encode_content", "true"), |
294 | 302 | resource.TestCheckResourceAttr(singularDatasourceName, "cache_control", "no-store"), |
295 | | - resource.TestCheckResourceAttr(singularDatasourceName, "content_disposition", "attachment; filename=\"filename.html\""), |
| 303 | + resource.TestCheckResourceAttr(singularDatasourceName, "content_disposition", "inline"), |
296 | 304 | resource.TestCheckResourceAttr(singularDatasourceName, "content_encoding", "identity"), |
297 | | - resource.TestCheckResourceAttr(singularDatasourceName, "content_language", "en-CA"), |
| 305 | + resource.TestCheckResourceAttr(singularDatasourceName, "content_language", "en-US"), |
298 | 306 | resource.TestCheckResourceAttr(singularDatasourceName, "content_length", "16"), |
299 | 307 | resource.TestCheckResourceAttr(singularDatasourceName, "content_md5", *md5B64Encode2), |
300 | | - resource.TestCheckResourceAttr(singularDatasourceName, "content_type", "text/xml"), |
| 308 | + resource.TestCheckResourceAttr(singularDatasourceName, "content_type", "text/plain"), |
| 309 | + resource.TestCheckResourceAttr(singularDatasourceName, "http_response_expires", expirationTimeForPar.Format(time.RFC3339Nano)), |
301 | 310 | resource.TestCheckResourceAttr(singularDatasourceName, "bucket", testBucketName), |
302 | 311 | resource.TestCheckResourceAttrSet(singularDatasourceName, "content"), |
303 | 312 | resource.TestCheckResourceAttr(singularDatasourceName, "content", base64.StdEncoding.EncodeToString([]byte("<a1>content</a1>"))), |
@@ -330,7 +339,6 @@ func TestObjectStorageObjectResource_basic(t *testing.T) { |
330 | 339 | Check: resource.ComposeAggregateTestCheckFunc( |
331 | 340 | resource.TestCheckResourceAttr(datasourceName, "bucket", testBucketName), |
332 | 341 | resource.TestCheckResourceAttrSet(datasourceName, "namespace"), |
333 | | - |
334 | 342 | resource.TestCheckResourceAttr(datasourceName, "objects.#", "1"), |
335 | 343 | resource.TestCheckResourceAttr(datasourceName, "delimiter", "/"), |
336 | 344 | resource.TestCheckResourceAttr(datasourceName, "end", "x"), |
|
0 commit comments