# Ghetto Fixtures

from codebox import app
from codebox.apps.auth.models import User
from codebox.apps.snippets.models import Snippet
from codebox.apps.organizations.models import Organization, OrganizationMember
from flask import g

client = app.test_client()
_ctx = app.test_request_context()
_ctx.push()
app.preprocess_request()
g.redis.flushdb()

User.objects.create(pk=1, name='zeeg')

Organization.objects.create(pk='disqus', name='DISQUS')

OrganizationMember.objects.create(org='disqus', user=1)

# Create sample snippets

# plaintext
Snippet.objects.create(org='disqus', user=1, lang='text', text = "Hello World!")
# python
Snippet.objects.create(org='disqus', user=1, lang='python', text = "print 'Disqus was here'")
# html
Snippet.objects.create(org='disqus', user=1, lang='html', text = '<h1>Look its HTML!</h1>')
# javascript
Snippet.objects.create(org='disqus', user=1, lang='javascript', text = "document.write('Di-squs')")


[(9, 'codebox.app.test_client', 'app.test_client', False, 'from codebox import app\n'), (10, 'codebox.app.test_request_context', 'app.test_request_context', False, 'from codebox import app\n'), (12, 'codebox.app.preprocess_request', 'app.preprocess_request', False, 'from codebox import app\n'), (13, 'flask.g.redis.flushdb', 'g.redis.flushdb', False, 'from flask import g\n'), (15, 'codebox.apps.auth.models.User.objects.create', 'User.objects.create', False, 'from codebox.apps.auth.models import User\n'), (17, 'codebox.apps.organizations.models.Organization.objects.create', 'Organization.objects.create', False, 'from codebox.apps.organizations.models import Organization, OrganizationMember\n'), (19, 'codebox.apps.organizations.models.OrganizationMember.objects.create', 'OrganizationMember.objects.create', False, 'from codebox.apps.organizations.models import Organization, OrganizationMember\n'), (24, 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', False, 'from codebox.apps.snippets.models import Snippet\n'), (26, 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', False, 'from codebox.apps.snippets.models import Snippet\n'), (28, 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', False, 'from codebox.apps.snippets.models import Snippet\n'), (30, 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', False, 'from codebox.apps.snippets.models import Snippet\n')]