1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Reverted JSONField change on VariableData and fixed related tests and migration. Also fixed older migrations that break when migrating backwards.

This commit is contained in:
Chris Church 2013-05-09 17:11:45 -04:00
parent d51fa4f629
commit 2cbed11034
7 changed files with 51 additions and 53 deletions

View File

@ -304,14 +304,14 @@ class VariableBaseDetail(BaseDetail):
pass pass
if this_object is None: if this_object is None:
this_object = self.__class__.model.objects.create(data=data) this_object = self.__class__.model.objects.create(data=python_json.dumps(data))
else: else:
this_object.data = data this_object.data = python_json.dumps(data)
this_object.save() this_object.save()
setattr(through_obj, self.__class__.reverse_relationship, this_object) setattr(through_obj, self.__class__.reverse_relationship, this_object)
through_obj.save() through_obj.save()
return Response(status=status.HTTP_200_OK, data=this_object.data) return Response(status=status.HTTP_200_OK, data=python_json.loads(this_object.data))
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
@ -327,7 +327,7 @@ class VariableBaseDetail(BaseDetail):
if this_object is None: if this_object is None:
new_args = {} new_args = {}
new_args['data'] = {} new_args['data'] = python_json.dumps(dict())
this_object = self.__class__.model.objects.create(**new_args) this_object = self.__class__.model.objects.create(**new_args)
setattr(through_obj, self.__class__.reverse_relationship, this_object) setattr(through_obj, self.__class__.reverse_relationship, this_object)
through_obj.save() through_obj.save()
@ -338,5 +338,5 @@ class VariableBaseDetail(BaseDetail):
if not check_user_access(request.user, Inventory, 'read', through_obj.inventory): if not check_user_access(request.user, Inventory, 'read', through_obj.inventory):
raise PermissionDenied raise PermissionDenied
return Response(status=status.HTTP_200_OK, data=this_object.data) return Response(status=status.HTTP_200_OK, data=python_json.loads(this_object.data))

View File

@ -47,7 +47,7 @@ class Command(NoArgsCommand):
'children': list(group.children.values_list('name', flat=True)), 'children': list(group.children.values_list('name', flat=True)),
} }
if group.variable_data is not None: if group.variable_data is not None:
group_info['vars'] = group.variable_data.data group_info['vars'] = json.loads(group.variable_data.data)
group_info = dict(filter(lambda x: bool(x[1]), group_info.items())) group_info = dict(filter(lambda x: bool(x[1]), group_info.items()))
if group_info.keys() in ([], ['hosts']): if group_info.keys() in ([], ['hosts']):
@ -66,7 +66,7 @@ class Command(NoArgsCommand):
raise CommandError('Host %s not found in the given inventory' % hostname) raise CommandError('Host %s not found in the given inventory' % hostname)
hostvars = {} hostvars = {}
if host.variable_data is not None: if host.variable_data is not None:
hostvars = host.variable_data.data hostvars = json.loads(host.variable_data.data)
self.stdout.write(json.dumps(hostvars, indent=indent)) self.stdout.write(json.dumps(hostvars, indent=indent))
def handle_noargs(self, **options): def handle_noargs(self, **options):

View File

@ -62,9 +62,11 @@ class Migration(SchemaMigration):
# Deleting field 'LaunchJobStatus.celery_task' # Deleting field 'LaunchJobStatus.celery_task'
db.delete_column(u'main_launchjobstatus', 'celery_task_id') db.delete_column(u'main_launchjobstatus', 'celery_task_id')
# Deleting field 'LaunchJobStatus.status'
db.delete_column(u'main_launchjobstatus', 'status')
# Changing field 'LaunchJobStatus.status' # Adding field 'LaunchJobStatus.status'
db.alter_column(u'main_launchjobstatus', 'status', self.gf('django.db.models.fields.IntegerField')()) db.add_column(u'main_launchjobstatus', 'status', self.gf('django.db.models.fields.IntegerField')(), keep_default=False)
models = { models = {
u'auth.group': { u'auth.group': {

View File

@ -31,6 +31,9 @@ class Migration(SchemaMigration):
# Deleting field 'LaunchJobStatusEvent.host' # Deleting field 'LaunchJobStatusEvent.host'
db.delete_column(u'main_launchjobstatusevent', 'host_id') db.delete_column(u'main_launchjobstatusevent', 'host_id')
# Deleting field 'LaunchJobStatus.celery_task_id'
db.delete_column(u'main_launchjobstatus', 'celery_task_id')
# Adding field 'LaunchJobStatus.celery_task' # Adding field 'LaunchJobStatus.celery_task'
db.add_column(u'main_launchjobstatus', 'celery_task', db.add_column(u'main_launchjobstatus', 'celery_task',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='launch_job_statuses', on_delete=models.SET_NULL, default=None, to=orm['djcelery.TaskMeta'], blank=True, null=True), self.gf('django.db.models.fields.related.ForeignKey')(related_name='launch_job_statuses', on_delete=models.SET_NULL, default=None, to=orm['djcelery.TaskMeta'], blank=True, null=True),
@ -39,9 +42,6 @@ class Migration(SchemaMigration):
# Deleting field 'LaunchJobStatus.result_traceback' # Deleting field 'LaunchJobStatus.result_traceback'
db.delete_column(u'main_launchjobstatus', 'result_traceback') db.delete_column(u'main_launchjobstatus', 'result_traceback')
# Deleting field 'LaunchJobStatus.celery_task_id'
db.delete_column(u'main_launchjobstatus', 'celery_task_id')
models = { models = {
u'auth.group': { u'auth.group': {

View File

@ -3,6 +3,7 @@ import datetime
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models from django.db import models
from django.utils.timezone import now
class Migration(SchemaMigration): class Migration(SchemaMigration):
@ -19,7 +20,7 @@ class Migration(SchemaMigration):
# Adding field 'Job.created' # Adding field 'Job.created'
db.add_column(u'main_job', 'created', db.add_column(u'main_job', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Adding field 'Job.failed' # Adding field 'Job.failed'
@ -35,7 +36,7 @@ class Migration(SchemaMigration):
# Adding field 'Inventory.created' # Adding field 'Inventory.created'
db.add_column(u'main_inventory', 'created', db.add_column(u'main_inventory', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Host.creation_date' # Deleting field 'Host.creation_date'
@ -43,7 +44,7 @@ class Migration(SchemaMigration):
# Adding field 'Host.created' # Adding field 'Host.created'
db.add_column(u'main_host', 'created', db.add_column(u'main_host', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Adding field 'Host.last_job' # Adding field 'Host.last_job'
@ -61,7 +62,7 @@ class Migration(SchemaMigration):
# Adding field 'Group.created' # Adding field 'Group.created'
db.add_column(u'main_group', 'created', db.add_column(u'main_group', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Credential.creation_date' # Deleting field 'Credential.creation_date'
@ -69,7 +70,7 @@ class Migration(SchemaMigration):
# Adding field 'Credential.created' # Adding field 'Credential.created'
db.add_column(u'main_credential', 'created', db.add_column(u'main_credential', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'JobTemplate.use_sudo' # Deleting field 'JobTemplate.use_sudo'
@ -80,7 +81,7 @@ class Migration(SchemaMigration):
# Adding field 'JobTemplate.created' # Adding field 'JobTemplate.created'
db.add_column(u'main_jobtemplate', 'created', db.add_column(u'main_jobtemplate', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
@ -91,7 +92,7 @@ class Migration(SchemaMigration):
# Adding field 'Team.created' # Adding field 'Team.created'
db.add_column(u'main_team', 'created', db.add_column(u'main_team', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Project.creation_date' # Deleting field 'Project.creation_date'
@ -99,7 +100,7 @@ class Migration(SchemaMigration):
# Adding field 'Project.created' # Adding field 'Project.created'
db.add_column(u'main_project', 'created', db.add_column(u'main_project', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Adding field 'JobEvent.failed' # Adding field 'JobEvent.failed'
@ -112,7 +113,7 @@ class Migration(SchemaMigration):
# Adding field 'Permission.created' # Adding field 'Permission.created'
db.add_column(u'main_permission', 'created', db.add_column(u'main_permission', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'VariableData.creation_date' # Deleting field 'VariableData.creation_date'
@ -120,25 +121,22 @@ class Migration(SchemaMigration):
# Adding field 'VariableData.created' # Adding field 'VariableData.created'
db.add_column(u'main_variabledata', 'created', db.add_column(u'main_variabledata', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
# Changing field 'VariableData.data'
db.alter_column(u'main_variabledata', 'data', self.gf('jsonfield.fields.JSONField')())
# Deleting field 'Organization.creation_date' # Deleting field 'Organization.creation_date'
db.delete_column(u'main_organization', 'creation_date') db.delete_column(u'main_organization', 'creation_date')
# Adding field 'Organization.created' # Adding field 'Organization.created'
db.add_column(u'main_organization', 'created', db.add_column(u'main_organization', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=now, blank=True),
keep_default=False) keep_default=False)
def backwards(self, orm): def backwards(self, orm):
# Adding field 'Job.creation_date' # Adding field 'Job.creation_date'
db.add_column(u'main_job', 'creation_date', db.add_column(u'main_job', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Adding field 'Job.use_sudo' # Adding field 'Job.use_sudo'
@ -157,12 +155,12 @@ class Migration(SchemaMigration):
# Deleting field 'Job.failed' # Deleting field 'Job.failed'
db.delete_column(u'main_job', 'failed') db.delete_column(u'main_job', 'failed')
# Changing field 'Job.extra_vars' (Disabled: something is broken when going from a TextField to JSONField)
#db.alter_column(u'main_job', 'extra_vars', self.gf('jsonfield.fields.JSONField')())
# Changing field 'Job.extra_vars'
db.alter_column(u'main_job', 'extra_vars', self.gf('jsonfield.fields.JSONField')())
# Adding field 'Inventory.creation_date' # Adding field 'Inventory.creation_date'
db.add_column(u'main_inventory', 'creation_date', db.add_column(u'main_inventory', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Inventory.created' # Deleting field 'Inventory.created'
@ -170,7 +168,7 @@ class Migration(SchemaMigration):
# Adding field 'Host.creation_date' # Adding field 'Host.creation_date'
db.add_column(u'main_host', 'creation_date', db.add_column(u'main_host', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Host.created' # Deleting field 'Host.created'
@ -184,7 +182,7 @@ class Migration(SchemaMigration):
# Adding field 'Group.creation_date' # Adding field 'Group.creation_date'
db.add_column(u'main_group', 'creation_date', db.add_column(u'main_group', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Group.created' # Deleting field 'Group.created'
@ -192,7 +190,7 @@ class Migration(SchemaMigration):
# Adding field 'Credential.creation_date' # Adding field 'Credential.creation_date'
db.add_column(u'main_credential', 'creation_date', db.add_column(u'main_credential', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Credential.created' # Deleting field 'Credential.created'
@ -205,18 +203,19 @@ class Migration(SchemaMigration):
# Adding field 'JobTemplate.creation_date' # Adding field 'JobTemplate.creation_date'
db.add_column(u'main_jobtemplate', 'creation_date', db.add_column(u'main_jobtemplate', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'JobTemplate.created' # Deleting field 'JobTemplate.created'
db.delete_column(u'main_jobtemplate', 'created') db.delete_column(u'main_jobtemplate', 'created')
# Changing field 'JobTemplate.extra_vars' # Changing field 'JobTemplate.extra_vars' (disabled: see above)
db.alter_column(u'main_jobtemplate', 'extra_vars', self.gf('jsonfield.fields.JSONField')()) #db.alter_column(u'main_jobtemplate', 'extra_vars', self.gf('jsonfield.fields.JSONField')())
# Adding field 'Team.creation_date' # Adding field 'Team.creation_date'
db.add_column(u'main_team', 'creation_date', db.add_column(u'main_team', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Team.created' # Deleting field 'Team.created'
@ -224,7 +223,7 @@ class Migration(SchemaMigration):
# Adding field 'Project.creation_date' # Adding field 'Project.creation_date'
db.add_column(u'main_project', 'creation_date', db.add_column(u'main_project', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Project.created' # Deleting field 'Project.created'
@ -235,7 +234,7 @@ class Migration(SchemaMigration):
# Adding field 'Permission.creation_date' # Adding field 'Permission.creation_date'
db.add_column(u'main_permission', 'creation_date', db.add_column(u'main_permission', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Permission.created' # Deleting field 'Permission.created'
@ -243,18 +242,15 @@ class Migration(SchemaMigration):
# Adding field 'VariableData.creation_date' # Adding field 'VariableData.creation_date'
db.add_column(u'main_variabledata', 'creation_date', db.add_column(u'main_variabledata', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'VariableData.created' # Deleting field 'VariableData.created'
db.delete_column(u'main_variabledata', 'created') db.delete_column(u'main_variabledata', 'created')
# Changing field 'VariableData.data'
db.alter_column(u'main_variabledata', 'data', self.gf('django.db.models.fields.TextField')())
# Adding field 'Organization.creation_date' # Adding field 'Organization.creation_date'
db.add_column(u'main_organization', 'creation_date', db.add_column(u'main_organization', 'creation_date',
self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.datetime(2013, 5, 8, 0, 0), blank=True), self.gf('django.db.models.fields.DateField')(auto_now_add=True, default=datetime.date.today, blank=True),
keep_default=False) keep_default=False)
# Deleting field 'Organization.created' # Deleting field 'Organization.created'
@ -506,7 +502,7 @@ class Migration(SchemaMigration):
'audit_trail': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'variabledata_by_audit_trail'", 'blank': 'True', 'to': "orm['main.AuditTrail']"}), 'audit_trail': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'variabledata_by_audit_trail'", 'blank': 'True', 'to': "orm['main.AuditTrail']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': '"{\'class\': \'variabledata\', \'app_label\': \'main\'}(class)s_created"', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['auth.User']"}), 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': '"{\'class\': \'variabledata\', \'app_label\': \'main\'}(class)s_created"', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['auth.User']"}),
'data': ('jsonfield.fields.JSONField', [], {'default': "''"}), 'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),

View File

@ -269,7 +269,7 @@ class VariableData(CommonModelNameNotUnique):
#host = models.OneToOneField('Host', null=True, default=None, blank=True, on_delete=SET_NULL, related_name='variable_data') #host = models.OneToOneField('Host', null=True, default=None, blank=True, on_delete=SET_NULL, related_name='variable_data')
#group = models.OneToOneField('Group', null=True, default=None, blank=True, on_delete=SET_NULL, related_name='variable_data') #group = models.OneToOneField('Group', null=True, default=None, blank=True, on_delete=SET_NULL, related_name='variable_data')
data = JSONField(default='') data = models.TextField(default='')
def __unicode__(self): def __unicode__(self):
return '%s = %s' % (self.name, self.data) return '%s = %s' % (self.name, self.data)

View File

@ -124,7 +124,7 @@ class AcomInventoryTest(BaseCommandTest):
hosts = [] hosts = []
for x in xrange(10): for x in xrange(10):
if n > 0: if n > 0:
variable_data = VariableData.objects.create(data={'ho': 'hum-%d' % x}) variable_data = VariableData.objects.create(data=json.dumps({'ho': 'hum-%d' % x}))
else: else:
variable_data = None variable_data = None
host = inventory.hosts.create(name='host-%02d-%02d.example.com' % (n, x), host = inventory.hosts.create(name='host-%02d-%02d.example.com' % (n, x),
@ -135,7 +135,7 @@ class AcomInventoryTest(BaseCommandTest):
groups = [] groups = []
for x in xrange(5): for x in xrange(5):
if n > 0: if n > 0:
variable_data = VariableData.objects.create(data={'gee': 'whiz-%d' % x}) variable_data = VariableData.objects.create(data=json.dumps({'gee': 'whiz-%d' % x}))
else: else:
variable_data = None variable_data = None
group = inventory.groups.create(name='group-%d' % x, group = inventory.groups.create(name='group-%d' % x,
@ -199,7 +199,7 @@ class AcomInventoryTest(BaseCommandTest):
set(group.hosts.values_list('name', flat=True))) set(group.hosts.values_list('name', flat=True)))
if group.variable_data: if group.variable_data:
self.assertEqual(v.get('vars', {}), self.assertEqual(v.get('vars', {}),
group.variable_data.data) json.loads(group.variable_data.data))
if k == 'group-3': if k == 'group-3':
self.assertEqual(set(v.get('children', [])), self.assertEqual(set(v.get('children', [])),
set(group.children.values_list('name', flat=True))) set(group.children.values_list('name', flat=True)))
@ -224,7 +224,7 @@ class AcomInventoryTest(BaseCommandTest):
host=host.name) host=host.name)
self.assertEqual(result, None) self.assertEqual(result, None)
data = json.loads(stdout) data = json.loads(stdout)
self.assertEqual(data, host.variable_data.data) self.assertEqual(data, json.loads(host.variable_data.data))
def test_invalid_host(self): def test_invalid_host(self):
# Valid host, but not part of the specified inventory. # Valid host, but not part of the specified inventory.