def test_FromJSON(self): json_str = '{"name":{"en-US":"test"},\ "description":{"en-US":"test"},\ "type":"test",\ "more_info":"test",\ "interaction_type":"choice",\ "correct_responses_pattern": ["test"],\ "choices": [], "scale": [], "source": [], "target": [], "steps": [],\ "extensions": {"test": "test"}}' adef = ActivityDefinition.from_json(json_str) self.definitionVerificationHelper(adef)
def test_FromJSONExceptionEmpty(self): with self.assertRaises(ValueError): ActivityDefinition.from_json('')
def test_FromJSONExceptionPartiallyMalformedJSON(self): with self.assertRaises(AttributeError): ActivityDefinition.from_json('{"test": "invalid property", "id": \ "valid property"}')
def test_FromJSONExceptionBadJSON(self): with self.assertRaises(ValueError): ActivityDefinition.from_json('{"bad JSON"}')
def test_FromJSONExceptionEmpty(self): with self.assertRaises(ValueError): ActivityDefinition.from_json("")
def test_FromJSONExceptionPartiallyMalformedJSON(self): with self.assertRaises(AttributeError): ActivityDefinition.from_json( '{"test": "invalid property", "id": \ "valid property"}' )