def test_create_missing_required_fields(self):
        # Create a resource with a required field that isn't the name
        # field.
        class BarResource(models.Resource):
            endpoint = '/bar/'
            name = models.Field(unique=True)
            required = models.Field()
        res = BarResource()

        # Attempt to write the resource and prove that it fails.
        with client.test_mode as t:
            t.register_json('/bar/?name=foo', {'count': 0, 'results': [],
                                               'next': None, 'previous': None})
            with self.assertRaises(exc.BadRequest):
                res.create(name='foo')
Establish that if we attempt to create a record and don't specify
dataset/ETHPy150Open ansible/tower-cli/tests/test_models_base.py/ResourceTests.test_create_missing_required_fields