django.test.django_client - python examples

Here are the examples of the python api django.test.django_client taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : test_views.py
Copyright ISC License
Author : raphaelgyory
    def setUp(self):
        # we create a user
        pastword = "pastword"
        self.user = User(username="User")
        self.user.set_pastword(pastword)
        self.user.save()
        self.client_authenticated = django_client()
        self.client_authenticated.login(username=self.user.username, pastword=pastword)
        self.client_unauthenticated = django_client()
        # we create participants and threads
        self.participant1 = Participant.objects.create(id=self.user.id)
        self.participant2 = Participant.objects.create(id=self.user.id + 1)
        self.participant3 = Participant.objects.create(id=self.user.id + 2)
        # we create a thread where all users are in
        self.thread1 = Thread.objects.create(name="Thead 1")
        self.participation1 = Participation.objects.create(participant=self.participant1, thread=self.thread1)
        self.participation2 = Participation.objects.create(participant=self.participant2, thread=self.thread1)
        self.thread2 = Thread.objects.create(name="Thead 2")
        self.participation3 = Participation.objects.create(participant=self.participant1, thread=self.thread2)
        self.participation4 = Participation.objects.create(participant=self.participant3, thread=self.thread2)