Commit Graph

3493 Commits (427b0da78e355b85a27aa12412a422e03cb77eb0)

Author SHA1 Message Date
Kieran Prasch cb4597321e BlockchainPolicy -> Policy 2022-12-07 11:29:26 +00:00
Kieran Prasch 9b38075d24 Partial correction of abstraction leak between Ursula an Operator by code reorg. 2022-12-07 11:29:26 +00:00
Kieran Prasch fda5c86db2 Removes "decentralized" and "blockchain" differentiation from "federated" 2022-12-07 11:29:26 +00:00
Kieran Prasch 7b7f2f071f Atomically unfederate (most of) the tests; Restores "federated" functionality by way of mocking. Takes advantage of fixture overriding to intercept testerchain. 2022-12-07 11:28:40 +00:00
James Campbell 19a1c4e7b3 Rename key to index in Return Value Test 2022-12-06 14:53:30 +00:00
James Campbell f07c030499 Improve docstrings and tests after restricting key to type int 2022-12-06 10:38:58 +00:00
James Campbell 4250e9f314 Restrict return value `key` to only be an integer 2022-12-05 16:58:57 +00:00
derekpierre 37ddd90830 Use thread-safe set for caching active ports.
Stop the use of MOCK_URSULA_START_PORT constant which may cause inadvertent port reuse.
Adjust rules for selecting ports to ensure early short circuit for invalid ports.
2022-11-24 10:51:01 -05:00
Kieran Prasch baac3db5fa Attempt to prevent network port reuse in tests 2022-11-24 10:00:16 -05:00
derekpierre d5e18dc56e Move common test function to utility module. 2022-11-21 12:53:25 -05:00
derekpierre 37ef40f482 Fixed incompatibility between Schema and their associated objects leading to invalid json being allowed, and valid json sometimes not being allowed.
Added tests.
2022-11-21 12:37:42 -05:00
derekpierre d540846163 Add additional tests for ConditionLingo, and empty rust Conditions on MessageKits. 2022-11-18 14:52:49 -05:00
derekpierre 2e0a1e5782 Add tests for conditions lingo validation. Use InvalidConditionLingo exception for invalid lingo grammar. 2022-11-18 13:42:25 -05:00
derekpierre 4cf9c7c70a Enrico now provides condition as actual None with no conditions are provided instead of an empty Conditions object.
Utilize better typing of condition dictionaries and its values.
Allow validation of conditions data without instantiation.
2022-11-18 10:33:15 -05:00
derekpierre c046e91e0b Add test to replicate failure case where Conditions are None instead of an empty Condition object. 2022-11-17 16:12:04 -05:00
Kieran Prasch 592c300461 update static files tests for twisted 22.10.0 2022-11-17 16:34:08 +00:00
Kieran Prasch 023494f4a2 respond to RFCs in PR #3021 2022-11-17 15:27:24 +00:00
Kieran Prasch 24b4b33265 post-rebase cleanup 2022-11-17 15:25:00 +00:00
Kieran Prasch ff3f414331 Sort fixtures that compile to localized acceptance/unit conftest respectively; Faster unit test suite. 2022-11-17 15:22:55 +00:00
Kieran Prasch fbfe0c8bc6 Fixturize test module constants 2022-11-17 15:22:53 +00:00
Kieran Prasch 38e8259e37 Cleanup test conditions data 2022-11-17 15:20:43 +00:00
Kieran Prasch 15b98e5479 de-duplicate condition fixture definition 2022-11-17 15:20:43 +00:00
James Campbell b7f23c7c16 Investigate types changing in condition parameters 2022-11-17 15:20:41 +00:00
derekpierre 7a389e2c39 Improve OperatorBondedTracker coverage. 2022-11-16 12:28:17 -05:00
derekpierre b2f71dd5c6 Add more conditions/lingo tests. 2022-11-16 12:28:17 -05:00
derekpierre dc488624e8 Improve testing for ConditionLingo, utils. Remove unceessary check for function_abi. 2022-11-16 12:28:15 -05:00
derekpierre ceee8bd2e9 Add tests for evaluate_condition() utils method. Fix incorrect type in method. 2022-11-16 12:27:12 -05:00
Kieran Prasch 6ca73c2849 remove lisence header from tests 2022-11-16 13:27:47 +00:00
KPrasch 0f27f974b3
Merge pull request #3014 from theref/functionAbi
Resolve `function_abi` AFTER condition is initialized
2022-11-15 16:29:53 +00:00
James Campbell bdaaafd9c3 Fix newsfragment and ensure conditions test has a valid method 2022-11-15 14:58:56 +00:00
James Campbell 4c5dadbad4 Resolve `function_abi` AFTER condition is initialized
Fixes #3012

Problem
-------
- when specifying a `standard_contract_type`, the `function_abi` is resolved
  immediately
- when this condition is serialized, it contains both `standard_contract_type`
  and `function_abi`, which we are trying to prevent

Solution
--------
- call `_resolve_abi` after the condition is initialized
2022-11-15 14:47:11 +00:00
derekpierre 47a8105509 Update coverage configuration to allow for better categorization of coverage reporting.
Fix coverage upload methodology.
Temporarily reduce python matrix until testing is completed.
2022-11-14 18:07:53 -05:00
derekpierre 853fa5406c Fixed bug regarding replacement of context variable when value is 0.
Added tests for return value test key as it pertains to tuples.
2022-11-14 15:50:18 -05:00
James Campbell 656ff8071c Improve error types raised by Return Values 2022-11-14 18:27:48 +00:00
James Campbell 775d890d3b Allow returnValueTest key to be None in serialization 2022-11-14 14:32:29 +00:00
Kieran Prasch 2c5db8e1f8 snake case t staking data fixture. 2022-11-14 14:32:29 +00:00
Kieran Prasch 38283661b1 Strict typing for _resolve_abi; Simplifies enforcement of single-function ABI for condition definition. 2022-11-14 14:32:27 +00:00
James Campbell 48cc132580 Use web3 to find functions from contract abi in return value test 2022-11-14 14:32:13 +00:00
James Campbell 52038237ad Add test to ensure eval can't run on context variable in return key 2022-11-14 14:32:13 +00:00
James Campbell e36b958912 Allow return value to be tuple and use modern `isinstance` over `type` 2022-11-14 14:32:13 +00:00
James Campbell 417c8b0fd4 Fix mocking of tester chain 2022-11-14 14:32:13 +00:00
James Campbell beec9958d1 Add test for method not in standard contract abi 2022-11-14 14:32:13 +00:00
James Campbell 6b2b072e12 Include tests for handling list index in ReturnValue 2022-11-14 14:32:13 +00:00
James Campbell b6f422ff4e Add basic tests for Return Value key 2022-11-14 14:32:10 +00:00
James Campbell 01d414b79a Fix parsing of function abi from standard contracts 2022-11-14 14:31:54 +00:00
James Campbell 65fede079c Ensure tests use valid condition chain id 2022-11-14 14:31:54 +00:00
James Campbell 3bbbc7b262 Fix function abi schema to be a dict 2022-11-14 14:31:54 +00:00
James Campbell 4ce6f72695 Add basic test for custom abi condition 2022-11-14 14:31:54 +00:00
Kieran Prasch 961faf04f7 Regression test for unintentional reencryption upon falsy conditions. 2022-11-11 17:39:58 +00:00
derekpierre fcafc627d6 Add test for NoConnectionToChain scenario when verifying conditions. 2022-11-10 09:50:41 -05:00
derekpierre 08bf1a0515 Code cleanup based on RFCs from #3007. 2022-11-10 09:16:36 -05:00
derekpierre 1a56decb1a Move condition-related exceptions to an exceptions module. 2022-11-09 19:20:17 -05:00
Kieran Prasch cb434e1a03 RFC: Do not mutate user-supplied condition context. 2022-11-09 13:32:49 +00:00
Kieran Prasch 19d3f16635 chain name -> chain id in test data. 2022-11-09 13:32:49 +00:00
Kieran Prasch 77e0f2a1d4 Reduce permitted chains to a tuple. 2022-11-08 02:03:25 +00:00
Kieran Prasch 812d0a1b62 Use function ABI only for custom contract condition fixtures. 2022-11-07 12:51:38 +00:00
Kieran Prasch d2dcdb9230 Introduce dynamic multi-chain support; enforce condition chain ID as an int. 2022-11-07 12:51:31 +00:00
KPrasch 785a59663b
Merge pull request #2993 from KPrasch/development
[WIP] Export reusable pytest fixtures and cleanup
2022-11-02 19:17:52 +01:00
derekpierre 8126116cb5 Fix failing contracts tests in gh action. 2022-11-02 12:22:44 -04:00
Kieran Prasch a405cbb683 Remove Ibex and Oryx from nucypher 2022-11-02 13:25:43 +00:00
Kieran Prasch db2aec026d use pytest-nucypher directly 2022-10-31 20:16:35 +00:00
Kieran Prasch 4e2bede69d Promote tests/mock and tests/utils to imporatable packages 2022-10-31 20:16:35 +00:00
Kieran Prasch f3dd8ec870 Remove unused stakeholder fixtures 2022-10-31 20:16:35 +00:00
Kieran Prasch 42d8e7d5de pytest11 entry points to export fixtures 2022-10-31 20:16:35 +00:00
Kieran Prasch 4a4e8dd594 Finishes removal of control package, it's usages and test utils 2022-10-27 22:22:46 +01:00
Kieran Prasch 73b6b8d15d Removes WebController and WebEmitter 2022-10-27 21:14:34 +01:00
Kieran Prasch d1269d1507 atomically extricate porter to nucypher/nucypher-porter 2022-10-27 17:26:32 +01:00
Kieran Prasch 24a5c5e035 Rmeoves Clef and Trezor signer tests 2022-10-27 10:13:18 +01:00
Kieran Prasch 1b040cf25f Removes db filepath configurations 2022-10-27 10:12:17 +01:00
Kieran Prasch febc6093c1 Removes lmdb datastore usage 2022-10-27 10:12:17 +01:00
Kieran Prasch 646246ae3f delete datastore modules 2022-10-27 10:12:17 +01:00
Kieran Prasch 17d3888c4d Remove unused specifications, consolidate the remaining ones for use by porter alone. 2022-10-26 13:55:38 +01:00
Kieran Prasch ba22a98db5 Removed RPC and web controller acceptance tests for characters 2022-10-25 20:01:54 +01:00
Kieran Prasch 2c4634acea Removes RPCController and Web controller functionality 2022-10-25 17:35:25 +01:00
Kieran Prasch 07bf78d9ff Removes Web and RPC controller entities 2022-10-25 17:35:25 +01:00
Kieran Prasch 52af298af4 Removes enrico CLI command 2022-10-25 17:35:25 +01:00
Kieran Prasch ccbb66497a Additional deprecation of alice/bob CLI commands. Consolidates ursula CLI config tests. 2022-10-25 16:19:21 +01:00
Kieran Prasch 8f015aa690 Accomodate deprecation of Alice, Bob, and Card CLI in internal APIs and tests. 2022-10-21 10:27:54 +01:00
Kieran Prasch ec07eee6d2 Removes Alice, Bob, and Card CLI 2022-10-18 20:22:25 +02:00
Kieran Prasch 31fb711297 post-rebase import fix 2022-10-18 20:17:42 +02:00
Kieran Prasch baac304d30 Removal of ConditionLingo bytes serialization assertion 2022-10-18 20:10:38 +02:00
Kieran Prasch 5fd04472ab Support for nucypher-core Address and updates ReencryptionResponse function signature 2022-10-18 20:10:38 +02:00
Kieran Prasch 9ae4d5c966 to/from wei method updates for web3 v6+ support 2022-10-18 20:10:37 +02:00
Kieran Prasch aa05019a68 Handle rust-native conditions newtype just-in-time; Co-existing with ConditionsLingo 2022-10-18 20:09:26 +02:00
derekpierre 19dfcd2030 Minor refactor to allow for easier testing in the future. 2022-10-18 20:09:26 +02:00
derekpierre b7f1a1085a Apply RFCs from #2980. 2022-10-18 20:09:26 +02:00
derekpierre 15819cde61 Time condition in test should use integers instead of strings. 2022-10-18 20:09:25 +02:00
derekpierre 27d6112de1 Exception occuring during RPC call is propagated back to the caller as error message.
Better exception handling by condition objects either at creation or verification - including some refactoring of RPCCondition/ContractCondition.
Added/updated unit tests.
2022-10-18 20:09:25 +02:00
derekpierre c7e16088fb Simple test that shows a contract call failure not properly handled during condition verification.
Code cleanup.
2022-10-18 20:09:25 +02:00
derekpierre e3446303b7 Remove support for None in ReturnValueTest - solidity has no concept of None/null so not needed. We can revisit later.
Updated condition tests to use 'is True' or 'is False'
Added SubscriptionManager test to show condition test whose contract call returns a struct and that the struct can be tested for equality/inequality.
2022-10-18 20:09:25 +02:00
derekpierre d0d71944b9 Remove __eq__ from ReturnValueTest obj - only needed for tests. 2022-10-18 20:09:25 +02:00
derekpierre 658a4470a2 Apply RFCs from #2974.
Co-authored-by: KPrasch <kieran@nucypher.com>
2022-10-18 20:09:25 +02:00
derekpierre 96c829d5a6 ReturnValueTest can now take any valid value type (including None) for comparison - this provides flexibility based on the result of a contract call.
String value types need to be quoted, but context variables are a special case of strings that don't need to be.
Added tests.
2022-10-18 20:09:25 +02:00
derekpierre d158221794 Add '!=' comparator as a valid comparator for ReturnValueTest.
Updated tests.
2022-10-18 20:09:25 +02:00
derekpierre 5baac258c4 Make SubscriptionManager condition tests pass now that the facilities to make it pass are now available. 2022-10-18 20:09:25 +02:00
derekpierre fb257cba7d Context variables used in ReturnValueTest were not being replaced - needed for the NFT use case. Modified the code to support it.
Updated ERC721 condition tests to use an actual ERC721 contract with a minted NFT.
Added ERC721 tests for balanceof.
2022-10-18 20:09:25 +02:00
derekpierre 0379ce7114 Parameter types for ContractConditions do not have to be strings - we need to be careful with types when checking whether a parameter is a context variable or not.
ERC721 ownerOf function takes an int and not a string which caused failures.
Added/updated tests.
2022-10-18 20:09:25 +02:00
David Núñez 36e5368f3c Add more basic unit tests for ReturnValueTest 2022-10-18 20:09:25 +02:00
David Núñez 7219c749ba Sanitize input to constructor of ReturnValueTest 2022-10-18 20:09:25 +02:00
David Núñez 56af2bf27f Basic unit test for ConditionLingo 2022-10-18 20:09:25 +02:00