-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…s-from-cached-wallet-db E2e tests against cached wallet db
- Loading branch information
Showing
14 changed files
with
335 additions
and
236 deletions.
There are no files selected for viewing
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
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
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## | ||
# Class for keeping track of wallet ids. WalletFactory keeps track of the context. | ||
# CONTEXT = Context.new | ||
# WalletFactory.create(:shelley, payload) | ||
# CONTEXT.shelley.each do |wid| | ||
# WalletFactory.delete(:shelley, wid) | ||
# end | ||
class Context | ||
attr_accessor :shelley, :shared, :byron | ||
def initialize | ||
clear! | ||
end | ||
|
||
def clear! | ||
@shelley = [] | ||
@shared = [] | ||
@byron = [] | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## | ||
# Factory helper for creating and deleting wallets and keeping their ids in shared context. | ||
# Assumes CONTEXT, SHELLEY, SHARED, BYRON to be initialized. | ||
class WalletFactory | ||
def self.create(type, payload) | ||
case type | ||
when :shelley | ||
wallet = SHELLEY.wallets.create(payload) | ||
CONTEXT.shelley << wallet['id'] | ||
wallet | ||
when :shared | ||
wallet = SHARED.wallets.create(payload) | ||
CONTEXT.shared << wallet['id'] | ||
wallet | ||
when :byron | ||
wallet = BYRON.wallets.create(payload) | ||
CONTEXT.byron << wallet['id'] | ||
wallet | ||
else | ||
raise "Unsupported wallet type: #{type}." | ||
end | ||
end | ||
|
||
def self.delete(type, wid) | ||
case type | ||
when :shelley | ||
CONTEXT.shelley.delete(wid) | ||
SHELLEY.wallets.delete(wid) | ||
when :shared | ||
CONTEXT.shared.delete(wid) | ||
SHARED.wallets.delete(wid) | ||
when :byron | ||
CONTEXT.byron.delete(wid) | ||
BYRON.wallets.delete(wid) | ||
else | ||
raise "Unsupported wallet type: #{type}." | ||
end | ||
end | ||
end |
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.