|
| 1 | +# Copyright IBM Corp. 2016 All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +from behave import * |
| 17 | +import json |
| 18 | + |
| 19 | + |
| 20 | +@when(u'a user deploys chaincode at path {path} with {args} with name {name}') |
| 21 | +def deploy_impl(context, path, args, name): |
| 22 | + pass |
| 23 | + |
| 24 | +@when(u'a user deploys chaincode at path {path} with {args}') |
| 25 | +def step_impl(context, path, args): |
| 26 | + deploy_impl(context, path, json.loads(args), "mycc") |
| 27 | + |
| 28 | +@when(u'a user deploys chaincode') |
| 29 | +def step_impl(context): |
| 30 | + deploy_impl(context, |
| 31 | + "github.com/hyperledger/fabric//chaincode_example02", |
| 32 | + ["init", "a", "100" , "b", "200"], |
| 33 | + "mycc") |
| 34 | + |
| 35 | +@when(u'a user queries on the chaincode named {name}') |
| 36 | +def query_impl(context, name): |
| 37 | + pass |
| 38 | + |
| 39 | +@when(u'a user queries on the chaincode') |
| 40 | +def step_impl(context): |
| 41 | + query_impl(context, "mycc") |
| 42 | + |
| 43 | +@when(u'a user invokes {count} times on the chaincode named {name} with args {args}') |
| 44 | +def invokes_impl(context, count, name, args): |
| 45 | + pass |
| 46 | + |
| 47 | +@when(u'a user invokes on the chaincode named {name} with args {args}') |
| 48 | +def step_impl(context, name, args): |
| 49 | + invokes_impl(context, 1, name, json.loads(args)) |
| 50 | + |
| 51 | +@when(u'a user invokes {count} times on the chaincode') |
| 52 | +def step_impl(context, count): |
| 53 | + invokes_impl(context, count, "mycc", ["txId1", "invoke", "a", 5]) |
| 54 | + |
| 55 | +@when(u'a user invokes on the chaincode named {name}') |
| 56 | +def step_impl(context, name): |
| 57 | + invokes_impl(context, 1, name, ["txId1", "invoke", "a", 5]) |
| 58 | + |
| 59 | +@when(u'a user invokes on the chaincode') |
| 60 | +def step_impl(context): |
| 61 | + invokes_impl(context, 1, "mycc", ["txId1", "invoke", "a", 5]) |
| 62 | + |
| 63 | +@then(u'the chaincode is deployed') |
| 64 | +def step_impl(context): |
| 65 | + pass |
| 66 | + |
| 67 | +@then(u'a user receives expected response') |
| 68 | +def step_impl(context): |
| 69 | + pass |
| 70 | + |
0 commit comments