From 5223e1d58e86be4475d48b93054e8f301f73ca17 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 8 Nov 2022 11:59:22 +0530 Subject: [PATCH] fix tests --- x/nameservice/README.md | 2 +- x/nameservice/client/testutil/grpc.go | 6 +++--- x/nameservice/client/testutil/query.go | 2 +- .../client/testutil/service_provider_example.yml | 12 ++++++++++++ x/nameservice/client/testutil/tx.go | 6 +++--- .../client/testutil/website_registration_example.yml | 6 ++++++ .../helpers/examples/service_provider_example.yml | 3 ++- x/nameservice/keeper/grpc_query_test.go | 1 + x/nameservice/types/attributes.go | 5 +++++ x/nameservice/types/codec.go | 6 ++++++ 10 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 x/nameservice/client/testutil/service_provider_example.yml create mode 100644 x/nameservice/client/testutil/website_registration_example.yml create mode 100644 x/nameservice/types/attributes.go diff --git a/x/nameservice/README.md b/x/nameservice/README.md index 032e5a7b..daa383e4 100644 --- a/x/nameservice/README.md +++ b/x/nameservice/README.md @@ -58,7 +58,7 @@ $ ./build/laconicd q nameservice params -o json | jq . > First you have to Create bond ```bash -$ ./build/laconicd tx nameservice set ~/Desktop/examples/records/example1.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 --yes -o json +$ ./build/laconicd tx nameservice set ~/Desktop/examples/records/service_provider_example.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 --yes -o json { "height": "0", "txhash": "BA44ABE1194724694E7CB290F9F3121DB4E63E1A030D95CB84813EEA132CF95F", diff --git a/x/nameservice/client/testutil/grpc.go b/x/nameservice/client/testutil/grpc.go index 86fcc7fc..91b8a350 100644 --- a/x/nameservice/client/testutil/grpc.go +++ b/x/nameservice/client/testutil/grpc.go @@ -209,7 +209,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { func(bondId string) { dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), @@ -353,7 +353,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { func(bondId string) { dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), @@ -626,7 +626,7 @@ func createRecord(bondID string, s *IntegrationTestSuite) { dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), diff --git a/x/nameservice/client/testutil/query.go b/x/nameservice/client/testutil/query.go index 08461a9e..7831ae8c 100644 --- a/x/nameservice/client/testutil/query.go +++ b/x/nameservice/client/testutil/query.go @@ -79,7 +79,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" args := []string{ payloadPath, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), diff --git a/x/nameservice/client/testutil/service_provider_example.yml b/x/nameservice/client/testutil/service_provider_example.yml new file mode 100644 index 00000000..b006dc95 --- /dev/null +++ b/x/nameservice/client/testutil/service_provider_example.yml @@ -0,0 +1,12 @@ + +record: + type: ServiceProviderRegistration + bond_id: madeUpBondID + laconic_id: madeUpLaconicID + x500: + common_name: cerc-io + organization_unit: xyz + organization_name: abc + state_name: california + country: US + locality_name: local \ No newline at end of file diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go index 60102073..6c2db65e 100644 --- a/x/nameservice/client/testutil/tx.go +++ b/x/nameservice/client/testutil/tx.go @@ -198,7 +198,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() { bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" tc.args = append([]string{payloadPath, bondID}, tc.args...) } @@ -580,7 +580,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" args := []string{ payloadPath, bondID, @@ -822,7 +822,7 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) - payloadPath := dir + "/example1.yml" + payloadPath := dir + "/service_provider_example.yml" txArgs := []string{ payloadPath, bondID, diff --git a/x/nameservice/client/testutil/website_registration_example.yml b/x/nameservice/client/testutil/website_registration_example.yml new file mode 100644 index 00000000..79c1de6a --- /dev/null +++ b/x/nameservice/client/testutil/website_registration_example.yml @@ -0,0 +1,6 @@ +record: + type: WebsiteRegistrationRecord + url: https://cerc.io + repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 + tls_cerc_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR \ No newline at end of file diff --git a/x/nameservice/helpers/examples/service_provider_example.yml b/x/nameservice/helpers/examples/service_provider_example.yml index b85862b4..b006dc95 100644 --- a/x/nameservice/helpers/examples/service_provider_example.yml +++ b/x/nameservice/helpers/examples/service_provider_example.yml @@ -8,4 +8,5 @@ record: organization_unit: xyz organization_name: abc state_name: california - country: US \ No newline at end of file + country: US + locality_name: local \ No newline at end of file diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go index 62db2b1d..4fcaebfa 100644 --- a/x/nameservice/keeper/grpc_query_test.go +++ b/x/nameservice/keeper/grpc_query_test.go @@ -71,6 +71,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { }, }, }, + All: true, }, true, false, diff --git a/x/nameservice/types/attributes.go b/x/nameservice/types/attributes.go new file mode 100644 index 00000000..00a7a785 --- /dev/null +++ b/x/nameservice/types/attributes.go @@ -0,0 +1,5 @@ +package types + +type Attributes interface { + GetType() string +} diff --git a/x/nameservice/types/codec.go b/x/nameservice/types/codec.go index fc97b989..7978ce8b 100644 --- a/x/nameservice/types/codec.go +++ b/x/nameservice/types/codec.go @@ -38,6 +38,12 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgDissociateRecords{}, &MsgReAssociateRecords{}, ) + + registry.RegisterInterface( + "vulcanize.nameservice.v1beta1.ServiceProvideRegistration", + (*Attributes)(nil), + &ServiceProviderRegistration{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) }