Example #1
0
 def setUp(self):
     factories.make_world()
     self.pb1 = PublicBody.objects.filter(jurisdiction__slug='bund')[0]
     self.pb2 = PublicBody.objects.filter(jurisdiction__slug='nrw')[0]
     ct = ContentType.objects.get_for_model(FoiRequest)
     self.perm = Permission.objects.get(content_type=ct,
                                        codename='create_batch')
Example #2
0
 def setUp(self):
     factories.make_world()
     self.pb1 = PublicBody.objects.filter(jurisdiction__slug='bund')[0]
     self.pb2 = PublicBody.objects.filter(jurisdiction__slug='nrw')[0]
     ct = ContentType.objects.get_for_model(FoiRequest)
     self.perm = Permission.objects.get(
         content_type=ct,
         codename='create_batch'
     )
Example #3
0
 def setUp(self):
     self.secret_address = '*****@*****.**'
     self.site = factories.make_world()
     self.req = factories.FoiRequestFactory.create(site=self.site,
         secret_address=self.secret_address, closed=True)
     factories.FoiMessageFactory.create(request=self.req)
     factories.FoiMessageFactory.create(request=self.req, is_response=True)
Example #4
0
 def setUp(self):
     site = factories.make_world()
     date = datetime(2010, 6, 5, 5, 54, 40, tzinfo=timezone.utc)
     req = factories.FoiRequestFactory.create(site=site,
         secret_address="*****@*****.**",
         first_message=date, last_message=date)
     factories.FoiMessageFactory.create(request=req, timestamp=date)
Example #5
0
File: tests.py Project: fin/froide
 def setUp(self):
     self.site = factories.make_world()
     self.admin_site = AdminSite()
     self.user_admin = UserAdmin(User, self.admin_site)
     self.factory = RequestFactory()
     self.user = User.objects.get(username='******')
     self.user.is_superuser = True
Example #6
0
 def setUp(self):
     self.site = factories.make_world()
     self.admin_site = AdminSite()
     self.user_admin = UserAdmin(User, self.admin_site)
     self.factory = RequestFactory()
     self.user = User.objects.get(username='******')
     self.user.is_superuser = True
Example #7
0
 def setUp(self):
     self.secret_address = '*****@*****.**'
     self.site = factories.make_world()
     self.req = factories.FoiRequestFactory.create(
         site=self.site, secret_address=self.secret_address, closed=True)
     factories.FoiMessageFactory.create(request=self.req)
     factories.FoiMessageFactory.create(request=self.req, is_response=True)
Example #8
0
 def setUp(self):
     self.site = factories.make_world()
     self.req = factories.FoiRequestFactory.create(
         site=self.site, secret_address="*****@*****.**")
     self.other_req = factories.FoiRequestFactory.create(
         site=self.site, secret_address="*****@*****.**")
     factories.FoiMessageFactory.create(request=self.req)
Example #9
0
 def setUp(self):
     self.site = factories.make_world()
     self.req = factories.FoiRequestFactory.create(site=self.site,
         secret_address="*****@*****.**")
     self.other_req = factories.FoiRequestFactory.create(site=self.site,
         secret_address="*****@*****.**")
     factories.FoiMessageFactory.create(request=self.req)
Example #10
0
 def setUp(self):
     site = factories.make_world()
     date = datetime(2010, 6, 5, 5, 54, 40, tzinfo=timezone.utc)
     req = factories.FoiRequestFactory.create(site=site,
         secret_address="*****@*****.**",
         first_message=date, last_message=date)
     factories.FoiMessageFactory.create(request=req, timestamp=date)
Example #11
0
 def setUp(self):
     self.secret_address = '*****@*****.**'
     self.site = factories.make_world()
     self.req = factories.FoiRequestFactory.create(site=self.site,
         secret_address=self.secret_address)
     factories.FoiMessageFactory.create(
         timestamp=timezone.now().replace(2012, 1, 1),
         request=self.req, recipient_email='*****@*****.**')
Example #12
0
    def setUp(self):
        factories.make_world()
        self.test_user = User.objects.get(username='******')
        self.dev_user = User.objects.create_user("*****@*****.**", "dev_user", "123456")

        self.application = Application.objects.create(
            name="Test Application",
            redirect_uris="http://localhost http://example.com http://example.org",
            user=self.dev_user,
            client_type=Application.CLIENT_CONFIDENTIAL,
            authorization_grant_type=Application.GRANT_AUTHORIZATION_CODE,
        )

        self.access_token = AccessToken.objects.create(
            user=self.test_user,
            scope="read:user",
            expires=timezone.now() + timedelta(seconds=300),
            token="secret-access-token-key",
            application=self.application
        )

        self.req = factories.FoiRequestFactory.create(
            visibility=FoiRequest.VISIBLE_TO_REQUESTER,
            user=self.test_user,
            title='permissions required'
        )
        self.mes = factories.FoiMessageFactory.create(
            request=self.req
        )
        self.att = factories.FoiAttachmentFactory.create(
            belongs_to=self.mes,
            approved=False
        )
        self.att2 = factories.FoiAttachmentFactory.create(
            belongs_to=self.mes,
            approved=True
        )
        factories.FoiRequestFactory.create(
            visibility=FoiRequest.VISIBLE_TO_REQUESTER,
            user=self.dev_user,
            title='never shown'
        )
        self.pb = PublicBody.objects.all()[0]
        self.request_list_url = reverse('api:request-list')
        self.message_detail_url = reverse('api:message-detail',
                                          kwargs={'pk': self.mes.pk})
Example #13
0
 def setUp(self):
     self.site = factories.make_world()
     self.admin_site = AdminSite()
     self.request_admin = FoiRequestAdmin(FoiRequest, self.admin_site)
     self.attachment_admin = FoiAttachmentAdmin(FoiAttachment,
                                                self.admin_site)
     self.factory = RequestFactory()
     self.user = User.objects.get(username='******')
     self.user.is_superuser = True
Example #14
0
 def setUp(self):
     self.site = factories.make_world()
     self.admin_site = AdminSite()
     self.request_admin = FoiRequestAdmin(FoiRequest,
         self.admin_site)
     self.attachment_admin = FoiAttachmentAdmin(FoiAttachment,
         self.admin_site)
     self.factory = RequestFactory()
     self.user = User.objects.get(username='******')
     self.user.is_superuser = True
Example #15
0
    def setUp(self):
        factories.make_world()
        self.test_user = User.objects.get(username='******')
        self.dev_user = User.objects.create_user("*****@*****.**", "dev_user", "123456")

        self.application = Application.objects.create(
            name="Test Application",
            redirect_uris="http://localhost http://example.com http://example.org",
            user=self.dev_user,
            client_type=Application.CLIENT_CONFIDENTIAL,
            authorization_grant_type=Application.GRANT_AUTHORIZATION_CODE,
        )

        self.access_token = AccessToken.objects.create(
            user=self.test_user,
            scope="read:user",
            expires=timezone.now() + timedelta(seconds=300),
            token="secret-access-token-key",
            application=self.application
        )
        self.profile_url = reverse('api-user-profile')
Example #16
0
    def setUp(self):
        factories.make_world()
        self.user = factories.UserFactory.create()

        self.owner_team = TeamFactory.create()
        TeamMembershipFactory.create(user=self.user,
                                     team=self.owner_team,
                                     role=TeamMembership.ROLE_OWNER)
        TeamMembershipFactory.create(team=self.owner_team,
                                     role=TeamMembership.ROLE_OWNER)

        self.editor_team = TeamFactory.create()
        TeamMembershipFactory.create(user=self.user,
                                     team=self.editor_team,
                                     role=TeamMembership.ROLE_EDITOR)
        TeamMembershipFactory.create(team=self.editor_team,
                                     role=TeamMembership.ROLE_OWNER)
        self.other_team = TeamFactory.create()
        TeamMembershipFactory.create(team=self.other_team,
                                     role=TeamMembership.ROLE_EDITOR)
        TeamMembershipFactory.create(team=self.other_team,
                                     role=TeamMembership.ROLE_OWNER)
Example #17
0
    def setUp(self):
        factories.make_world()
        self.test_user = User.objects.get(username='******')
        self.dev_user = User.objects.create_user("*****@*****.**", "dev_user",
                                                 "123456")

        self.application = Application.objects.create(
            name="Test Application",
            redirect_uris=
            "http://localhost http://example.com http://example.org",
            user=self.dev_user,
            client_type=Application.CLIENT_CONFIDENTIAL,
            authorization_grant_type=Application.GRANT_AUTHORIZATION_CODE,
        )

        self.access_token = AccessToken.objects.create(
            user=self.test_user,
            scope="read:user",
            expires=timezone.now() + timedelta(seconds=300),
            token="secret-access-token-key",
            application=self.application)
        self.profile_url = reverse('api-user-profile')
Example #18
0
 def setUp(self):
     factories.make_world()
Example #19
0
 def setUp(self):
     factories.make_world()
Example #20
0
 def setUp(self):
     self.site = factories.make_world()
Example #21
0
 def setUp(self):
     self.secret_address = '*****@*****.**'
     self.site = factories.make_world()
     date = datetime(2010, 6, 5, 5, 54, 40, tzinfo=timezone.utc)
     req = factories.FoiRequestFactory.create(
         site=self.site,
         secret_address=self.secret_address,
         first_message=date,
         last_message=date)
     factories.FoiMessageFactory.create(request=req, timestamp=date)
     self.post_data = {
         "From":
         "*****@*****.**",
         "FromFull": {
             "Email": "*****@*****.**",
             "Name": "John Doe"
         },
         "To":
         self.secret_address,
         "ToFull": [{
             "Email": self.secret_address,
             "Name": ""
         }],
         "Cc":
         "\"Full name\" <*****@*****.**>, \"Another Cc\" <*****@*****.**>",
         "CcFull": [{
             "Email": "*****@*****.**",
             "Name": "Full name"
         }, {
             "Email": "*****@*****.**",
             "Name": "Another Cc"
         }],
         "ReplyTo":
         "*****@*****.**",
         "Subject":
         "This is an inbound message",
         "MessageID":
         "22c74902-a0c1-4511-804f2-341342852c90",
         "Date":
         "Thu, 5 Apr 2012 16:59:01 +0200",
         "MailboxHash":
         "ahoy",
         "TextBody":
         "[ASCII]",
         "HtmlBody":
         "[HTML(encoded)]",
         "Tag":
         "",
         "Headers": [{
             "Name":
             "X-Spam-Checker-Version",
             "Value":
             "SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.wildbit.com"
         }, {
             "Name": "X-Spam-Status",
             "Value": "No"
         }, {
             "Name": "X-Spam-Score",
             "Value": "-0.1"
         }, {
             "Name":
             "X-Spam-Tests",
             "Value":
             "DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS"
         }, {
             "Name":
             "Received-SPF",
             "Value":
             "Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.160.180; helo=mail-gy0-f180.google.com; [email protected]; receiver=451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com"
         }, {
             "Name":
             "DKIM-Signature",
             "Value":
             "v=1; a=rsa-sha256; c=relaxed/relaxed;                d=wildbit.com; s=google;                h=mime-version:reply-to:date:message-id:subject:from:to:cc                 :content-type;                bh=cYr/+oQiklaYbBJOQU3CdAnyhCTuvemrU36WT7cPNt0=;                b=QsegXXbTbC4CMirl7A3VjDHyXbEsbCUTPL5vEHa7hNkkUTxXOK+dQA0JwgBHq5C+1u                 iuAJMz+SNBoTqEDqte2ckDvG2SeFR+Edip10p80TFGLp5RucaYvkwJTyuwsA7xd78NKT                 Q9ou6L1hgy/MbKChnp2kxHOtYNOrrszY3JfQM="
         }, {
             "Name": "MIME-Version",
             "Value": "1.0"
         }, {
             "Name":
             "Message-ID",
             "Value":
             "<*****@*****.**>"
         }],
         "Attachments": [{
             "Name": "myimage.png",
             "Content": "[BASE64-ENCODED CONTENT]",
             "ContentType": "image/png",
             "ContentLength": 4096,
             "ContentID": "[email protected]"
         }, {
             "Name": "mypaper.doc",
             "Content": "[BASE64-ENCODED CONTENT]",
             "ContentType": "application/msword",
             "ContentLength": 16384,
             "ContentID": ""
         }]
     }
Example #22
0
 def setUp(self):
     factories.make_world()
     factories.rebuild_index()
     self.user = User.objects.get(username='******')
     self.pb = PublicBody.objects.all()[0]
Example #23
0
 def setUp(self):
     factories.make_world()
     self.pb = PublicBody.objects.all()[0]
Example #24
0
 def setUp(self):
     factories.make_world()
     factories.rebuild_index()
     self.do_logout()
     self.user = User.objects.all()[0]
     self.pb = PublicBody.objects.all()[0]
Example #25
0
 def setUp(self):
     self.site = make_world()
     translation.activate(settings.LANGUAGE_CODE)
Example #26
0
 def setUp(self):
     self.site = make_world()
     translation.activate(settings.LANGUAGE_CODE)
Example #27
0
 def setUp(self):
     factories.make_world()
     factories.rebuild_index()
     self.user = User.objects.get(username='******')
     self.pb = PublicBody.objects.all()[0]
Example #28
0
 def setUp(self):
     self.site = factories.make_world()
     date = datetime(2010, 6, 5, 5, 54, 40, tzinfo=timezone.utc)
     req = factories.FoiRequestFactory.create(site=self.site,
         secret_address="*****@*****.**",
         first_message=date, last_message=date)
     factories.FoiMessageFactory.create(request=req, timestamp=date)
     self.post_data = {
         "From": "*****@*****.**",
         "FromFull": {
             "Email": "*****@*****.**",
             "Name": "John Doe"
         },
         "To": "*****@*****.**",
         "ToFull": [
             {
                 "Email": "*****@*****.**",
                 "Name": ""
             }
         ],
         "Cc": "\"Full name\" <*****@*****.**>, \"Another Cc\" <*****@*****.**>",
         "CcFull": [
             {
                 "Email": "*****@*****.**",
                 "Name": "Full name"
             },
             {
                 "Email": "*****@*****.**",
                 "Name": "Another Cc"
             }
         ],
         "ReplyTo": "*****@*****.**",
         "Subject": "This is an inbound message",
         "MessageID": "22c74902-a0c1-4511-804f2-341342852c90",
         "Date": "Thu, 5 Apr 2012 16:59:01 +0200",
         "MailboxHash": "ahoy",
         "TextBody": "[ASCII]",
         "HtmlBody": "[HTML(encoded)]",
         "Tag": "",
         "Headers": [
             {
                 "Name": "X-Spam-Checker-Version",
                 "Value": "SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.wildbit.com"
             },
             {
                 "Name": "X-Spam-Status",
                 "Value": "No"
             },
             {
                 "Name": "X-Spam-Score",
                 "Value": "-0.1"
             },
             {
                 "Name": "X-Spam-Tests",
                 "Value": "DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS"
             },
             {
                 "Name": "Received-SPF",
                 "Value": "Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.160.180; helo=mail-gy0-f180.google.com; [email protected]; receiver=451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com"
             },
             {
                 "Name": "DKIM-Signature",
                 "Value": "v=1; a=rsa-sha256; c=relaxed\/relaxed;                d=wildbit.com; s=google;                h=mime-version:reply-to:date:message-id:subject:from:to:cc                 :content-type;                bh=cYr\/+oQiklaYbBJOQU3CdAnyhCTuvemrU36WT7cPNt0=;                b=QsegXXbTbC4CMirl7A3VjDHyXbEsbCUTPL5vEHa7hNkkUTxXOK+dQA0JwgBHq5C+1u                 iuAJMz+SNBoTqEDqte2ckDvG2SeFR+Edip10p80TFGLp5RucaYvkwJTyuwsA7xd78NKT                 Q9ou6L1hgy\/MbKChnp2kxHOtYNOrrszY3JfQM="
             },
             {
                 "Name": "MIME-Version",
                 "Value": "1.0"
             },
             {
                 "Name": "Message-ID",
                 "Value": "<*****@*****.**>"
             }
         ],
         "Attachments": [
             {
                 "Name": "myimage.png",
                 "Content": "[BASE64-ENCODED CONTENT]",
                 "ContentType": "image/png",
                 "ContentLength": 4096,
                 "ContentID": "[email protected]"
             },
             {
                 "Name": "mypaper.doc",
                 "Content": "[BASE64-ENCODED CONTENT]",
                 "ContentType": "application/msword",
                 "ContentLength": 16384,
                 "ContentID": ""
             }
         ]
     }
Example #29
0
 def setUp(self):
     factories.make_world()
     factories.rebuild_index()
     self.do_logout()
     self.user = User.objects.all()[0]
     self.pb = PublicBody.objects.all()[0]
Example #30
0
 def setUp(self):
     clear_lru_caches()
     self.site = factories.make_world()
Example #31
0
 def setUp(self):
     self.site = factories.make_world()
Example #32
0
 def setUp(self):
     clear_lru_caches()
     self.site = factories.make_world()