(t *testing.T)
| 640 | } |
| 641 | |
| 642 | func TestCollectionSerialize(t *testing.T) { |
| 643 | scenarios := []struct { |
| 644 | name string |
| 645 | collection func() *core.Collection |
| 646 | expected []string |
| 647 | notExpected []string |
| 648 | }{ |
| 649 | { |
| 650 | "base", |
| 651 | func() *core.Collection { |
| 652 | c := core.NewCollection(core.CollectionTypeBase, "test") |
| 653 | c.ViewQuery = "1=1" |
| 654 | c.OAuth2.Providers = []core.OAuth2ProviderConfig{ |
| 655 | {Name: "test1", ClientId: "test_client_id1", ClientSecret: "test_client_secret1"}, |
| 656 | {Name: "test2", ClientId: "test_client_id2", ClientSecret: "test_client_secret2"}, |
| 657 | } |
| 658 | |
| 659 | return c |
| 660 | }, |
| 661 | []string{ |
| 662 | `"id":"pbc_`, |
| 663 | `"name":"test"`, |
| 664 | `"type":"base"`, |
| 665 | }, |
| 666 | []string{ |
| 667 | "verificationTemplate", |
| 668 | "manageRule", |
| 669 | "authRule", |
| 670 | "secret", |
| 671 | "oauth2", |
| 672 | "clientId", |
| 673 | "clientSecret", |
| 674 | "viewQuery", |
| 675 | }, |
| 676 | }, |
| 677 | { |
| 678 | "view", |
| 679 | func() *core.Collection { |
| 680 | c := core.NewCollection(core.CollectionTypeView, "test") |
| 681 | c.ViewQuery = "1=1" |
| 682 | c.OAuth2.Providers = []core.OAuth2ProviderConfig{ |
| 683 | {Name: "test1", ClientId: "test_client_id1", ClientSecret: "test_client_secret1"}, |
| 684 | {Name: "test2", ClientId: "test_client_id2", ClientSecret: "test_client_secret2"}, |
| 685 | } |
| 686 | |
| 687 | return c |
| 688 | }, |
| 689 | []string{ |
| 690 | `"id":"pbc_`, |
| 691 | `"name":"test"`, |
| 692 | `"type":"view"`, |
| 693 | `"viewQuery":"1=1"`, |
| 694 | }, |
| 695 | []string{ |
| 696 | "verificationTemplate", |
| 697 | "manageRule", |
| 698 | "authRule", |
| 699 | "secret", |
nothing calls this directly
no test coverage detected
searching dependent graphs…