示例#1
0
 def setUp(self):
     journal_kwargs = dict(code="test", domain="journal.org")
     press_kwargs = dict(domain="press.org", )
     self.middleware = SiteSettingsMiddleware()
     self.request_factory = RequestFactory()
     self.journal = make_test_journal(**journal_kwargs)
     self.press = Press(**press_kwargs)
     self.press.save()
示例#2
0
 def setUp(self):
     self.request_factory = RequestFactory()
     self.press = Press(domain="sitetestpress.org")
     self.press.save()
     self.request_factory
     journal_kwargs = dict(
         code="modeltests",
         domain="sitetest.org",
     )
     self.journal = make_test_journal(**journal_kwargs)
示例#3
0
    def setUp(self):
        journal_kwargs = dict(code="test", domain="journal.org")
        press_kwargs = dict(domain="press.org", )
        self.middleware = TimezoneMiddleware()
        self.request_factory = RequestFactory()
        self.journal = make_test_journal(**journal_kwargs)
        self.press = Press(**press_kwargs)
        self.press.save()

        self.regular_user = helpers.create_user("*****@*****.**")
        self.regular_user.is_active = True
        self.regular_user.save()
示例#4
0
    def test_domain_mode_site_url_for_other_site(self):
        other_journal = make_test_journal(
            code="otherjournalwithdomain",
            domain="otherjournalwithdomain.org",
        )
        response = self.client.get("/banana",
                                   SERVER_NAME="otherjournalwithdomain.org")
        result = self.journal.site_url()

        expected = "http://" + self.journal.domain

        self.assertEqual(expected, result)
示例#5
0
    def test_path_mode_site_url_for_other_site(self):
        other_journal = make_test_journal(
            code="otherjournalwithpath",
            domain="otherjournalwithpath.org",
        )
        response = self.client.get("/otherjournalwithpath/banana",
                                   SERVER_NAME="sitetest.org")
        result = self.journal.site_url()

        expected = "http://{}/{}".format(
            self.press.domain,
            self.journal.code,
        )

        self.assertEqual(expected, result)