def test_dict_field(self): """Test :meth:`nailgun.entity_fields.DictField.gen_value`. Assert that an empty dict is returned by default. There are very few occurrences of dict fields in the entity classes, so it is hard to intelligently produce a randomized value that will be of use in a wide variety of entities. Instead, those few entities override or extend this method. """ self.assertEqual(entity_fields.DictField().gen_value(), {})
def __init__(self, server_config=None, **kwargs): self._fields = { 'audit_comment': entity_fields.StringField(), 'description_format': entity_fields.StringField(), 'effective_user': entity_fields.DictField(), 'job_category': entity_fields.StringField(), 'location': entity_fields.OneToManyField(Location), 'locked': entity_fields.BooleanField(), 'name': entity_fields.StringField(), 'organization': entity_fields.OneToManyField(Organization), 'provider_type': entity_fields.StringField(), 'snippet': entity_fields.BooleanField(), 'template': entity_fields.StringField(), 'template_inputs': entity_fields.OneToManyField(TemplateInput), } self._meta = { 'api_path': 'api/v2/job_templates', 'server_modes': ('sat')} super(JobTemplate, self).__init__(server_config, **kwargs)