| 460 | } |
| 461 | |
| 462 | func TestExpiredObjectDeleteMarker(t *testing.T) { |
| 463 | expected := []byte(`{"Rules":[{"Expiration":{"ExpiredObjectDeleteMarker":true},"ID":"expired-object-delete-marker","Status":"Enabled"}]}`) |
| 464 | lc := Configuration{ |
| 465 | Rules: []Rule{ |
| 466 | { |
| 467 | Expiration: Expiration{ |
| 468 | DeleteMarker: true, |
| 469 | }, |
| 470 | ID: "expired-object-delete-marker", |
| 471 | Status: "Enabled", |
| 472 | }, |
| 473 | }, |
| 474 | } |
| 475 | |
| 476 | got, err := json.Marshal(lc) |
| 477 | if err != nil { |
| 478 | t.Fatalf("Failed to marshal due to %v", err) |
| 479 | } |
| 480 | if !bytes.Equal(expected, got) { |
| 481 | t.Fatalf("Expected %s but got %s", expected, got) |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | func TestAllVersionsExpiration(t *testing.T) { |
| 486 | expected := []byte(`{"Rules":[{"AllVersionsExpiration":{"Days":2,"DeleteMarker":true},"ID":"all-versions-expiration","Status":"Enabled"}]}`) |