# 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')")


[((243, 260), 'codebox.app.test_client', 'app.test_client', ([], {}), '()\n', (258, 260), False, 'from codebox import app\n'), ((268, 294), 'codebox.app.test_request_context', 'app.test_request_context', ([], {}), '()\n', (292, 294), False, 'from codebox import app\n'), ((307, 331), 'codebox.app.preprocess_request', 'app.preprocess_request', ([], {}), '()\n', (329, 331), False, 'from codebox import app\n'), ((332, 349), 'flask.g.redis.flushdb', 'g.redis.flushdb', ([], {}), '()\n', (347, 349), False, 'from flask import g\n'), ((351, 389), 'codebox.apps.auth.models.User.objects.create', 'User.objects.create', ([], {'pk': '(1)', 'name': '"""zeeg"""'}), "(pk=1, name='zeeg')\n", (370, 389), False, 'from codebox.apps.auth.models import User\n'), ((391, 446), 'codebox.apps.organizations.models.Organization.objects.create', 'Organization.objects.create', ([], {'pk': '"""disqus"""', 'name': '"""DISQUS"""'}), "(pk='disqus', name='DISQUS')\n", (418, 446), False, 'from codebox.apps.organizations.models import Organization, OrganizationMember\n'), ((448, 503), 'codebox.apps.organizations.models.OrganizationMember.objects.create', 'OrganizationMember.objects.create', ([], {'org': '"""disqus"""', 'user': '(1)'}), "(org='disqus', user=1)\n", (481, 503), False, 'from codebox.apps.organizations.models import Organization, OrganizationMember\n'), ((543, 621), 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', ([], {'org': '"""disqus"""', 'user': '(1)', 'lang': '"""text"""', 'text': '"""Hello World!"""'}), "(org='disqus', user=1, lang='text', text='Hello World!')\n", (565, 621), False, 'from codebox.apps.snippets.models import Snippet\n'), ((633, 729), 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', ([], {'org': '"""disqus"""', 'user': '(1)', 'lang': '"""python"""', 'text': '"""print \'Disqus was here\'"""'}), '(org=\'disqus\', user=1, lang=\'python\', text=\n    "print \'Disqus was here\'")\n', (655, 729), False, 'from codebox.apps.snippets.models import Snippet\n'), ((734, 828), 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', ([], {'org': '"""disqus"""', 'user': '(1)', 'lang': '"""html"""', 'text': '"""<h1>Look its HTML!</h1>"""'}), "(org='disqus', user=1, lang='html', text=\n    '<h1>Look its HTML!</h1>')\n", (756, 828), False, 'from codebox.apps.snippets.models import Snippet\n'), ((839, 941), 'codebox.apps.snippets.models.Snippet.objects.create', 'Snippet.objects.create', ([], {'org': '"""disqus"""', 'user': '(1)', 'lang': '"""javascript"""', 'text': '"""document.write(\'Di-squs\')"""'}), '(org=\'disqus\', user=1, lang=\'javascript\', text=\n    "document.write(\'Di-squs\')")\n', (861, 941), False, 'from codebox.apps.snippets.models import Snippet\n')]