Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse(self):
d = parameters.DictParameter()._p.parse_from_str(
json.dumps(TestDictParameter._dict)
)
assert d == TestDictParameter._dict
def test_parse_invalid_input(self):
with pytest.raises(ValueError):
parameters.DictParameter()._p.parse_from_str('{"invalid"}')
def test_parse_and_serialize(self):
inputs = [
'{"username": "me", "password": "secret"}',
'{"password": "secret", "username": "me"}',
]
for json_input in inputs:
_dict = parameters.DictParameter()._p.parse_from_str(json_input)
assert json.loads(json_input) == _dict
# See the License for the specific language governing permissions and
# limitations under the License.
#
import collections
import json
import pytest
from databand import parameters
from dbnd.testing.helpers import build_task
from dbnd_test_scenarios.test_common.task.factories import TTask
class DictParameterTask(TTask):
param = parameters.DictParameter()
class TestDictParameter(object):
_dict = collections.OrderedDict([("username", "me"), ("password", "secret")])
def test_parse(self):
d = parameters.DictParameter()._p.parse_from_str(
json.dumps(TestDictParameter._dict)
)
assert d == TestDictParameter._dict
def test_parse_and_serialize(self):
inputs = [
'{"username": "me", "password": "secret"}',
'{"password": "secret", "username": "me"}',
]