-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:desmos-labs/desmos into riccardo/…
…subspaces-sections-implementation � Conflicts: � x/posts/keeper/genesis_test.go
- Loading branch information
Showing
10 changed files
with
861 additions
and
171 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
.changeset/entries/2d669aab39870b7eaaf8b21adf683bd518eebe6408cffbbc67feb787dddf5d75.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ func (suite *KeeperTestsuite) TestKeeper_ExportGenesis() { | |
expGenesis: types.NewGenesisState([]types.SubspaceDataEntry{ | ||
types.NewSubspaceDataEntry(1, 1), | ||
types.NewSubspaceDataEntry(2, 2), | ||
}, nil, nil, nil, types.Params{}), | ||
}, nil, nil, nil, nil, types.Params{}), | ||
}, | ||
{ | ||
name: "posts are exported properly", | ||
|
@@ -113,7 +113,7 @@ func (suite *KeeperTestsuite) TestKeeper_ExportGenesis() { | |
time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC), | ||
nil, | ||
)), | ||
}, nil, nil, types.Params{}), | ||
}, nil, nil, nil, types.Params{}), | ||
}, | ||
{ | ||
name: "attachments are exported properly", | ||
|
@@ -137,7 +137,56 @@ func (suite *KeeperTestsuite) TestKeeper_ExportGenesis() { | |
"ftp://user:[email protected]/image.png", | ||
"image/png", | ||
)), | ||
}, nil, types.Params{}), | ||
}, nil, nil, types.Params{}), | ||
}, | ||
{ | ||
name: "active polls are exported properly", | ||
store: func(ctx sdk.Context) { | ||
suite.k.SetParams(ctx, types.Params{}) | ||
suite.k.SaveAttachment(ctx, types.NewAttachment(1, 1, 2, types.NewPoll( | ||
"What animal is best?", | ||
[]types.Poll_ProvidedAnswer{ | ||
types.NewProvidedAnswer("Cat", nil), | ||
types.NewProvidedAnswer("Dog", nil), | ||
}, | ||
time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC), | ||
false, | ||
false, | ||
nil, | ||
))) | ||
suite.k.InsertActivePollQueue(ctx, types.NewAttachment(1, 1, 2, types.NewPoll( | ||
"What animal is best?", | ||
[]types.Poll_ProvidedAnswer{ | ||
types.NewProvidedAnswer("Cat", nil), | ||
types.NewProvidedAnswer("Dog", nil), | ||
}, | ||
time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC), | ||
false, | ||
false, | ||
nil, | ||
))) | ||
}, | ||
expGenesis: types.NewGenesisState( | ||
nil, | ||
nil, | ||
[]types.Attachment{ | ||
types.NewAttachment(1, 1, 2, types.NewPoll( | ||
"What animal is best?", | ||
[]types.Poll_ProvidedAnswer{ | ||
types.NewProvidedAnswer("Cat", nil), | ||
types.NewProvidedAnswer("Dog", nil), | ||
}, | ||
time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC), | ||
false, | ||
false, | ||
nil, | ||
)), | ||
}, | ||
[]types.ActivePollData{ | ||
types.NewActivePollData(1, 1, 2, time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC)), | ||
}, | ||
nil, | ||
types.Params{}), | ||
}, | ||
{ | ||
name: "user answers are exported properly", | ||
|
@@ -146,7 +195,7 @@ func (suite *KeeperTestsuite) TestKeeper_ExportGenesis() { | |
suite.k.SaveUserAnswer(ctx, types.NewUserAnswer(1, 1, 1, []uint32{1}, "cosmos1vs8dps0ktst5ekynmszxuxphfq08rhmepsn8st")) | ||
suite.k.SaveUserAnswer(ctx, types.NewUserAnswer(1, 1, 2, []uint32{1, 2, 3}, "cosmos1vs8dps0ktst5ekynmszxuxphfq08rhmepsn8st")) | ||
}, | ||
expGenesis: types.NewGenesisState(nil, nil, nil, []types.UserAnswer{ | ||
expGenesis: types.NewGenesisState(nil, nil, nil, nil, []types.UserAnswer{ | ||
types.NewUserAnswer(1, 1, 1, []uint32{1}, "cosmos1vs8dps0ktst5ekynmszxuxphfq08rhmepsn8st"), | ||
types.NewUserAnswer(1, 1, 2, []uint32{1, 2, 3}, "cosmos1vs8dps0ktst5ekynmszxuxphfq08rhmepsn8st"), | ||
}, types.Params{}), | ||
|
@@ -156,7 +205,7 @@ func (suite *KeeperTestsuite) TestKeeper_ExportGenesis() { | |
store: func(ctx sdk.Context) { | ||
suite.k.SetParams(ctx, types.NewParams(20)) | ||
}, | ||
expGenesis: types.NewGenesisState(nil, nil, nil, nil, types.NewParams(20)), | ||
expGenesis: types.NewGenesisState(nil, nil, nil, nil, nil, types.NewParams(20)), | ||
}, | ||
} | ||
|
||
|
@@ -304,69 +353,6 @@ func (suite *KeeperTestsuite) TestKeeper_ImportGenesis() { | |
)), stored) | ||
}, | ||
}, | ||
{ | ||
name: "poll attachment is added to active poll queue properly", | ||
store: func(ctx sdk.Context) { | ||
suite.sk.SaveSubspace(ctx, subspacestypes.NewSubspace( | ||
1, | ||
"Test subspace", | ||
"This is a test subspace", | ||
"cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69", | ||
"cosmos1m0czrla04f7rp3zg7dsgc4kla54q7pc4xt00l5", | ||
"cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69", | ||
time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC), | ||
)) | ||
|
||
suite.k.SavePost(ctx, types.NewPost( | ||
1, | ||
0, | ||
1, | ||
"External ID", | ||
"This is a text", | ||
"cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", | ||
1, | ||
nil, | ||
nil, | ||
types.REPLY_SETTING_EVERYONE, | ||
time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC), | ||
nil, | ||
)) | ||
}, | ||
data: types.GenesisState{ | ||
Attachments: []types.Attachment{ | ||
types.NewAttachment(1, 1, 1, types.NewPoll( | ||
"What animal is best?", | ||
[]types.Poll_ProvidedAnswer{ | ||
types.NewProvidedAnswer("Cat", nil), | ||
types.NewProvidedAnswer("Dog", nil), | ||
}, | ||
time.Date(3000, 1, 1, 12, 00, 00, 000, time.UTC), | ||
false, | ||
false, | ||
nil, | ||
)), | ||
}, | ||
}, | ||
check: func(ctx sdk.Context) { | ||
stored, found := suite.k.GetAttachment(ctx, 1, 1, 1) | ||
suite.Require().True(found) | ||
suite.Require().Equal(types.NewAttachment(1, 1, 1, types.NewPoll( | ||
"What animal is best?", | ||
[]types.Poll_ProvidedAnswer{ | ||
types.NewProvidedAnswer("Cat", nil), | ||
types.NewProvidedAnswer("Dog", nil), | ||
}, | ||
time.Date(3000, 1, 1, 12, 00, 00, 000, time.UTC), | ||
false, | ||
false, | ||
nil, | ||
)), stored) | ||
|
||
store := ctx.KVStore(suite.storeKey) | ||
endDate := time.Date(3000, 1, 1, 12, 00, 00, 000, time.UTC) | ||
suite.Require().True(store.Has(types.ActivePollQueueKey(1, 1, 1, endDate))) | ||
}, | ||
}, | ||
{ | ||
name: "user answer is imported properly", | ||
store: func(ctx sdk.Context) { | ||
|
@@ -418,6 +404,18 @@ func (suite *KeeperTestsuite) TestKeeper_ImportGenesis() { | |
suite.Require().Equal(types.NewUserAnswer(1, 1, 1, []uint32{1}, "cosmos1vs8dps0ktst5ekynmszxuxphfq08rhmepsn8st"), stored) | ||
}, | ||
}, | ||
{ | ||
name: "active polls are imported properly", | ||
data: types.GenesisState{ | ||
ActivePolls: []types.ActivePollData{ | ||
types.NewActivePollData(1, 1, 2, time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC)), | ||
}, | ||
}, | ||
check: func(ctx sdk.Context) { | ||
store := ctx.KVStore(suite.storeKey) | ||
suite.Require().True(store.Has(types.ActivePollQueueKey(1, 1, 2, time.Date(2100, 1, 1, 12, 00, 00, 000, time.UTC)))) | ||
}, | ||
}, | ||
{ | ||
name: "params are imported properly", | ||
data: types.GenesisState{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.