Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 943b7dc528
Fetching contributors…

Cannot retrieve contributors at this time

executable file 75 lines (57 sloc) 2.029 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#!/usr/bin/env python2.7

from __future__ import print_function

import os
import site
import sys

root = '/home/derrickpetzold/'
sys.path.append(root)
site.addsitedir(root + 'lib/python2.7/site-packages')
os.environ['DJANGO_SETTINGS_MODULE'] = 'derrickpetzold.settings'

import argparse
import json
import random
import re
import tempfile
import time

from bakku import progress
from bakku import stream
from bakku import temp
from bakku import util
from bakku import string_util
from bakku.test import base
from bakku.test import formatter

from derrickpetzold import settings
from derrickpetzold import models

from django.contrib.contenttypes.models import ContentType
from django.contrib.webdesign import lorem_ipsum as lorem

class TestSite(base.TestBase):

    cookie_path = settings.SITE_ROOT + '/../tmp/cookies-session.jar'

    def __init__(self, **kwargs):
        # login
        super(TestSite, self).__init__(**kwargs)

    def test_post(self):
        response = self.retrieve(
                self.host + 'comment/post/',
                object_pk=1,
                content_type='derrickpetzold.post',
                title=lorem.words(random.randint(3, 6), common=False),
                text=lorem.paragraph())

        assert response.success == True, 'Post failed: %s' % (response.error)
        self.output.writeln('Post: Ok (%.2f)' % (response.run_time))

    def test_reply(self):
        response = self.retrieve(
                self.host + 'comment/post/',
                object_pk=1,
                parent_id=1,
                content_type='derrickpetzold.post',
                title=lorem.words(random.randint(3, 6), common=False),
                text=lorem.paragraph())

        assert response.success == True, 'Reply failed: %s' % (response.error)
        self.output.writeln('Reply: Ok (%.2f)' % (response.run_time))


def main():

    TestSite(
        csrf_url='/login/',
        settings=settings,
        formatter=formatter.YamlFormatter()).run()

if __name__ == '__main__':
    main()
Something went wrong with that request. Please try again.