def test_edit_no_login(self):
     self.add_domain()
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            adding_domain_form(),
                            follow=True)
     # Make sure it redirects to login page
     goodRedirect = "/login/?next=%s" % (quote_plus("/edit/1/"))
     self.assertRedirects(res, goodRedirect)
Esempio n. 2
0
 def test_add(self):
     self.client.login(username='******', password='******')
     domain = models.DomainRequest.objects.filter(name="test.com")
     assert_false(domain)
     res = self.client.post(reverse("ispdb_add"), adding_domain_form())
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.get(name="test.com")
     assert isinstance(domain, models.DomainRequest)
Esempio n. 3
0
 def test_add_missing_name(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["display_name"] = ""
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 4
0
 def test_add(self):
     self.client.login(username='******', password='******')
     domain = models.DomainRequest.objects.filter(name="test.com")
     assert_false(domain)
     res = self.client.post(reverse("ispdb_add"), adding_domain_form())
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.get(name="test.com")
     assert isinstance(domain, models.DomainRequest)
Esempio n. 5
0
 def test_add_missing_name(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["display_name"] = ""
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 6
0
 def test_add_only_deleted_domains(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["domain-0-DELETE"] = "True"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 7
0
 def test_edit_no_login(self):
     self.add_domain()
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            adding_domain_form(),
                            follow=True)
     # Make sure it redirects to login page
     goodRedirect = "/login/?next=%s" % (quote_plus("/edit/1/"))
     self.assertRedirects(res, goodRedirect)
Esempio n. 8
0
 def test_add_only_deleted_domains(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["domain-0-DELETE"] = "True"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
 def test_edit_invalid_user(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            adding_domain_form(),
                            follow=True)
     # Make sure it redirects to login page
     goodRedirect = "/login/"
     self.assertRedirects(res, goodRedirect)
Esempio n. 10
0
 def test_add_negative_port(self):
     self.client.login(username='******', password='******')
     port = "-1000"
     domain_form = adding_domain_form()
     domain_form["incoming_port"] = port
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 11
0
 def test_add_negative_port(self):
     self.client.login(username='******', password='******')
     port = "-1000"
     domain_form = adding_domain_form()
     domain_form["incoming_port"] = port
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 12
0
 def test_edit_invalid_user(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            adding_domain_form(),
                            follow=True)
     # Make sure it redirects to login page
     goodRedirect = "/login/"
     self.assertRedirects(res, goodRedirect)
Esempio n. 13
0
 def test_add_aaa_domains(self):
     self.client.login(username='******', password='******')
     before = models.DomainRequest.objects.all().count()
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "aaa"
     assert_raises(ValidationError, self.client.post, reverse("ispdb_add"),
                   domain_form)
     after = models.DomainRequest.objects.all().count()
     assert_equal(before, after)
Esempio n. 14
0
 def test_edit_duplicated_names(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["domain-1-name"] = "test.com"
     form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     assert_equal(res.status_code, fail_code)
 def test_edit_duplicated_names(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["domain-1-name"] = "test.com"
     form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     assert_equal(res.status_code, fail_code)
Esempio n. 16
0
 def test_add_aaa_domains(self):
     self.client.login(username='******', password='******')
     before = models.DomainRequest.objects.all().count()
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "aaa"
     assert_raises(ValidationError,
                   self.client.post,
                   reverse("ispdb_add"),
                   domain_form)
     after = models.DomainRequest.objects.all().count()
     assert_equal(before, after)
 def add_domain(self, name='test.com'):
     self.client.login(username='******', password='******')
     domain = models.DomainRequest.objects.filter(name=name)
     assert_false(domain)
     form = adding_domain_form()
     form["domain-0-name"] = name
     res = self.client.post(reverse("ispdb_add"), form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.get(name=name)
     assert isinstance(domain, models.DomainRequest)
     self.client.logout()
Esempio n. 18
0
 def add_domain(self, name='test.com'):
     self.client.login(username='******', password='******')
     domain = models.DomainRequest.objects.filter(name=name)
     assert_false(domain)
     form = adding_domain_form()
     form["domain-0-name"] = name
     res = self.client.post(reverse("ispdb_add"), form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.get(name=name)
     assert isinstance(domain, models.DomainRequest)
     self.client.logout()
Esempio n. 19
0
 def test_add_09_domains(self):
     self.client.login(username='******', password='******')
     num_domains = 9
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "09"
     for i in range(num_domains):
         domain_form["domain-%d-name" % i] = "test%d.com" % i
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     for i in range(num_domains):
         assert_true(models.DomainRequest.objects.filter(
             name="test%d.com" % i))
Esempio n. 20
0
 def test_add_duplicated_domain_names(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "2",
     domain_form["domain-0-name"] = "test.com"
     domain_form["domain-0-DELETE"] = "False"
     domain_form["domain-1-name"] = "test.com"
     domain_form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 21
0
 def test_add_duplicated_domain_names(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "2",
     domain_form["domain-0-name"] = "test.com"
     domain_form["domain-0-DELETE"] = "False"
     domain_form["domain-1-name"] = "test.com"
     domain_form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     model = models.DomainRequest.objects.filter(name="test.com")
     assert_false(model)
Esempio n. 22
0
 def test_add_09_domains(self):
     self.client.login(username='******', password='******')
     num_domains = 9
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = "09"
     for i in range(num_domains):
         domain_form["domain-%d-name" % i] = "test%d.com" % i
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     for i in range(num_domains):
         assert_true(
             models.DomainRequest.objects.filter(name="test%d.com" % i))
Esempio n. 23
0
 def test_add_bad_number_domains(self):
     self.client.login(username='******', password='******')
     num_domains = 11
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = num_domains
     for i in range(num_domains):
         domain_form["domain-%d-name" % i] = "test%d.com" % i
         domain_form["domain-%d-DELETE" % i] = "False"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     for i in range(num_domains):
         assert_false(models.DomainRequest.objects.filter(
             name="test%d.com" % i))
Esempio n. 24
0
 def test_add_bad_number_domains(self):
     self.client.login(username='******', password='******')
     num_domains = 11
     domain_form = adding_domain_form()
     domain_form["domain-TOTAL_FORMS"] = num_domains
     for i in range(num_domains):
         domain_form["domain-%d-name" % i] = "test%d.com" % i
         domain_form["domain-%d-DELETE" % i] = "False"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, fail_code)
     for i in range(num_domains):
         assert_false(
             models.DomainRequest.objects.filter(name="test%d.com" % i))
Esempio n. 25
0
 def test_add_one_deleted_inst(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["inst_0-TOTAL_FORMS"] = "2",
     domain_form["inst_0-1-id"] = ""
     domain_form["inst_0-1-DELETE"] = "True"
     domain_form["inst_0-1-language"] = "en"
     domain_form["inst_0-1-description"] = "test2"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     model = models.EnableURLInst.objects.filter(description="test")
     assert_true(model)
     model = models.EnableURLInst.objects.filter(description="test2")
     assert_false(model)
Esempio n. 26
0
 def test_add_one_deleted_inst(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["inst_0-TOTAL_FORMS"] = "2",
     domain_form["inst_0-1-id"] = ""
     domain_form["inst_0-1-DELETE"] = "True"
     domain_form["inst_0-1-language"] = "en"
     domain_form["inst_0-1-description"] = "test2"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     model = models.EnableURLInst.objects.filter(description="test")
     assert_true(model)
     model = models.EnableURLInst.objects.filter(description="test2")
     assert_false(model)
Esempio n. 27
0
 def test_add_existing_domain(self):
     self.add_domain(name='approved.com')
     self.add_domain()
     self.client.login(username='******', password='******')
     self.client.post("/approve/1/", {
             "approved": True, })
     config = models.Config.objects.get(id=1)
     assert_equal(config.status, 'approved')
     form = adding_domain_form()
     form["domain-1-name"] = "approved.com"
     form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     assert_equal(res.status_code, fail_code)
Esempio n. 28
0
 def test_edit_locked_config(self):
     self.add_domain()
     config = models.Config.objects.get(pk=1)
     config.locked = True
     config.save()
     form = adding_domain_form()
     form["display_name"] = "testing2"
     self.client.login(username='******', password='******')
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                      form,
                      follow=True)
     config = models.Config.objects.get(pk=1)
     assert_true(config.display_name != "testing2")
     assert_true("This configuration is locked. Only admins can unlock it."
         in res.content)
 def test_edit_locked_config(self):
     self.add_domain()
     config = models.Config.objects.get(pk=1)
     config.locked = True
     config.save()
     form = adding_domain_form()
     form["display_name"] = "testing2"
     self.client.login(username='******', password='******')
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     config = models.Config.objects.get(pk=1)
     assert_true(config.display_name != "testing2")
     assert_true("This configuration is locked. Only admins can unlock it."
                 in res.content)
Esempio n. 30
0
 def test_add_duplicate_domain(self):
     self.client.login(username='******', password='******')
     name = "test.com"
     domain = models.Domain.objects.filter(name=name)
     assert_false(domain)
     domain_form = adding_domain_form()
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.filter(name=name)
     assert_true(domain)
     assert isinstance(domain[0], models.DomainRequest)
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.filter(name=name)
     assert_true(len(domain) == 2)
Esempio n. 31
0
 def test_add_duplicate_domain(self):
     self.client.login(username='******', password='******')
     name = "test.com"
     domain = models.Domain.objects.filter(name=name)
     assert_false(domain)
     domain_form = adding_domain_form()
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.filter(name=name)
     assert_true(domain)
     assert isinstance(domain[0], models.DomainRequest)
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     domain = models.DomainRequest.objects.filter(name=name)
     assert_true(len(domain) == 2)
 def test_add_existing_domain(self):
     self.add_domain(name='approved.com')
     self.add_domain()
     self.client.login(username='******', password='******')
     self.client.post("/approve/1/", {
         "approved": True,
     })
     config = models.Config.objects.get(id=1)
     assert_equal(config.status, 'approved')
     form = adding_domain_form()
     form["domain-1-name"] = "approved.com"
     form["domain-1-DELETE"] = "False"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     assert_equal(res.status_code, fail_code)
Esempio n. 33
0
 def test_owner_edit_approved_domain(self):
     self.add_domain(name='approved.com')
     self.client.login(username='******', password='******')
     self.client.post("/approve/1/", {
             "approved": True, })
     config = models.Config.objects.get(id=1)
     assert_equal(config.status, 'approved')
     self.client.logout()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["incoming_hostname"] = "bar"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     goodRedirect = "/login/"
     self.assertRedirects(res, goodRedirect)
 def test_owner_edit_approved_domain(self):
     self.add_domain(name='approved.com')
     self.client.login(username='******', password='******')
     self.client.post("/approve/1/", {
         "approved": True,
     })
     config = models.Config.objects.get(id=1)
     assert_equal(config.status, 'approved')
     self.client.logout()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["incoming_hostname"] = "bar"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     goodRedirect = "/login/"
     self.assertRedirects(res, goodRedirect)
Esempio n. 35
0
 def test_add_internationalization(self):
     self.client.login(username='******', password='******')
     domains = [
         u"Iñtërnâtiônàlizætiøn.com",
         u"郵件.商務",
         u"मोहन.ईन्फो",
         u"екзампл.ком",
         u"εχαμπλε.ψομ",
         u"ящик-с-апельсинами.рф",
     ]
     for name in domains:
         dom = models.DomainRequest.objects.filter(name=name)
         assert_false(dom)
         domain_form = adding_domain_form()
         domain_form["domain-0-name"] = name
         res = self.client.post(reverse("ispdb_add"), domain_form)
         assert_equal(res.status_code, success_code)
         domain = models.DomainRequest.objects.get(name=name)
         assert isinstance(domain, models.DomainRequest)
         assert_equal(domain.name, name)
Esempio n. 36
0
 def test_add_internationalization(self):
     self.client.login(username='******', password='******')
     domains = [
         u"Iñtërnâtiônàlizætiøn.com",
         u"郵件.商務",
         u"मोहन.ईन्फो",
         u"екзампл.ком",
         u"εχαμπλε.ψομ",
         u"ящик-с-апельсинами.рф",
     ]
     for name in domains:
         dom = models.DomainRequest.objects.filter(name=name)
         assert_false(dom)
         domain_form = adding_domain_form()
         domain_form["domain-0-name"] = name
         res = self.client.post(reverse("ispdb_add"), domain_form)
         assert_equal(res.status_code, success_code)
         domain = models.DomainRequest.objects.get(name=name)
         assert isinstance(domain, models.DomainRequest)
         assert_equal(domain.name, name)
Esempio n. 37
0
    def test_add_with_unconfirmed(self):
        self.client.login(username='******', password='******')
        name = "test.com"
        unclaimed_after = models.DomainRequest.objects.filter(name=name,
                                                              config=None)
        assert_false(unclaimed_after)

        asking_form = asking_domain_form()
        asking_form["domain-0-name"] = name
        self.client.post(reverse("ispdb_add"), asking_form)
        unclaimed = models.DomainRequest.objects.get(name=name, config=None)
        assert_true(unclaimed)

        domain_form = adding_domain_form()
        domain_form["domain-0-name"] = name
        self.client.post(reverse("ispdb_add"), domain_form)
        unclaimed_after = models.DomainRequest.objects.filter(name=name,
                                                              config=None)
        assert_false(unclaimed_after)
        model = models.DomainRequest.objects.get(name=name)
        assert isinstance(model, models.DomainRequest)
Esempio n. 38
0
 def test_add_invalid_domains(self):
     self.client.login(username='******', password='******')
     domains = [
         'test',
         'test_test.com',
         'test.c',
         100 * 'test' + '.com',
         '127.0.0.1',
         'example.',
         'com.',
         'invalid-.com',
         '-invalid.com',
         'inv-.alid-.com',
         'inv-.-alid.com',
         '[a',
     ]
     for domain in domains:
         domain_form = adding_domain_form()
         domain_form["domain-0-name"] = domain
         res = self.client.post(reverse("ispdb_add"), domain_form)
         assert_equal(res.status_code, fail_code)
         assert_false(models.DomainRequest.objects.filter(name=domain))
Esempio n. 39
0
 def test_edit_same_user(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["domain-INITIAL_FORMS"] = "1"
     form["domain-0-id"] = "1"
     form["domain-0-name"] = "test1.com"
     form["display_name"] = "testing2"
     form["docurl-INITIAL_FORMS"] = "1"
     form["docurl-0-id"] = "1"
     form["docurl-0-url"] = "http://test1.com/"
     form["desc_0-INITIAL_FORMS"] = "1"
     form["desc_0-0-id"] = "1"
     form["desc_0-0-description"] = "test1"
     form["enableurl-INITIAL_FORMS"] = "1"
     form["enableurl-0-id"] = "1"
     form["enableurl-0-url"] = "http://test1.com/"
     form["inst_0-INITIAL_FORMS"] = "1"
     form["inst_0-0-id"] = "1"
     form["inst_0-0-description"] = "test1"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     goodRedirect = "/details/1/"
     self.assertRedirects(res, goodRedirect)
     assert_true(len(models.Config.objects.all()), 1)
     domain = models.DomainRequest.objects.get(pk=1)
     assert_true(domain)
     assert isinstance(domain, models.DomainRequest)
     assert_equal(domain.name, 'test1.com')
     assert_equal(domain.config.display_name, 'testing2')
     docurl = models.DocURL.objects.get(pk=1)
     assert_equal(docurl.url, 'http://test1.com/')
     desc = models.DocURLDesc.objects.get(pk=1)
     assert_equal(desc.description, 'test1')
     enableurl = models.EnableURL.objects.get(pk=1)
     assert_equal(enableurl.url, 'http://test1.com/')
     inst = models.EnableURLInst.objects.get(pk=1)
     assert_equal(inst.description, 'test1')
Esempio n. 40
0
 def test_add_invalid_domains(self):
     self.client.login(username='******', password='******')
     domains = [
         'test',
         'test_test.com',
         'test.c',
         100 * 'test' + '.com',
         '127.0.0.1',
         'example.',
         'com.',
         'invalid-.com',
         '-invalid.com',
         'inv-.alid-.com',
         'inv-.-alid.com',
         '[a',
     ]
     for domain in domains:
         domain_form = adding_domain_form()
         domain_form["domain-0-name"] = domain
         res = self.client.post(reverse("ispdb_add"), domain_form)
         assert_equal(res.status_code, fail_code)
         assert_false(models.DomainRequest.objects.filter(name=domain))
Esempio n. 41
0
    def test_add_with_unconfirmed(self):
        self.client.login(username='******', password='******')
        name = "test.com"
        unclaimed_after = models.DomainRequest.objects.filter(name=name,
                                                              config=None)
        assert_false(unclaimed_after)

        asking_form = asking_domain_form()
        asking_form["domain-0-name"] = name
        self.client.post(reverse("ispdb_add"), asking_form)
        unclaimed = models.DomainRequest.objects.get(name=name,
                                                     config=None)
        assert_true(unclaimed)

        domain_form = adding_domain_form()
        domain_form["domain-0-name"] = name
        self.client.post(reverse("ispdb_add"), domain_form)
        unclaimed_after = models.DomainRequest.objects.filter(name=name,
                                                              config=None)
        assert_false(unclaimed_after)
        model = models.DomainRequest.objects.get(name=name)
        assert isinstance(model, models.DomainRequest)
 def test_edit_same_user(self):
     self.add_domain()
     self.client.login(username='******', password='******')
     form = adding_domain_form()
     form["domain-INITIAL_FORMS"] = "1"
     form["domain-0-id"] = "1"
     form["domain-0-name"] = "test1.com"
     form["display_name"] = "testing2"
     form["docurl-INITIAL_FORMS"] = "1"
     form["docurl-0-id"] = "1"
     form["docurl-0-url"] = "http://test1.com/"
     form["desc_0-INITIAL_FORMS"] = "1"
     form["desc_0-0-id"] = "1"
     form["desc_0-0-description"] = "test1"
     form["enableurl-INITIAL_FORMS"] = "1"
     form["enableurl-0-id"] = "1"
     form["enableurl-0-url"] = "http://test1.com/"
     form["inst_0-INITIAL_FORMS"] = "1"
     form["inst_0-0-id"] = "1"
     form["inst_0-0-description"] = "test1"
     res = self.client.post(reverse("ispdb_edit", args=[1]),
                            form,
                            follow=True)
     goodRedirect = "/details/1/"
     self.assertRedirects(res, goodRedirect)
     assert_true(len(models.Config.objects.all()), 1)
     domain = models.DomainRequest.objects.get(pk=1)
     assert_true(domain)
     assert isinstance(domain, models.DomainRequest)
     assert_equal(domain.name, 'test1.com')
     assert_equal(domain.config.display_name, 'testing2')
     docurl = models.DocURL.objects.get(pk=1)
     assert_equal(docurl.url, 'http://test1.com/')
     desc = models.DocURLDesc.objects.get(pk=1)
     assert_equal(desc.description, 'test1')
     enableurl = models.EnableURL.objects.get(pk=1)
     assert_equal(enableurl.url, 'http://test1.com/')
     inst = models.EnableURLInst.objects.get(pk=1)
     assert_equal(inst.description, 'test1')
Esempio n. 43
0
 def test_add_one_deleted_enableurl(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["enableurl-TOTAL_FORMS"] = "2",
     domain_form["enableurl-0-url"] = "http://test.com"
     domain_form["enableurl-0-DELETE"] = "False"
     domain_form["enableurl-1-id"] = ""
     domain_form["enableurl-1-url"] = "http://test2.com"
     domain_form["enableurl-1-DELETE"] = "True"
     domain_form["inst_1-INITIAL_FORMS"] = "0"
     domain_form["inst_1-TOTAL_FORMS"] = "1"
     domain_form["inst_1-MAX_NUM_FORMS"] = ""
     domain_form["inst_1-0-id"] = ""
     domain_form["inst_1-0-DELETE"] = "False"
     domain_form["inst_1-0-language"] = "en"
     domain_form["inst_1-0-description"] = "test2"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     model = models.EnableURL.objects.filter(url="http://test.com/")
     assert_true(model)
     model = models.EnableURL.objects.filter(url="http://test2.com/")
     assert_false(model)
     model = models.EnableURLInst.objects.filter(description="test2")
     assert_false(model)
Esempio n. 44
0
 def test_add_one_deleted_enableurl(self):
     self.client.login(username='******', password='******')
     domain_form = adding_domain_form()
     domain_form["enableurl-TOTAL_FORMS"] = "2",
     domain_form["enableurl-0-url"] = "http://test.com"
     domain_form["enableurl-0-DELETE"] = "False"
     domain_form["enableurl-1-id"] = ""
     domain_form["enableurl-1-url"] = "http://test2.com"
     domain_form["enableurl-1-DELETE"] = "True"
     domain_form["inst_1-INITIAL_FORMS"] = "0"
     domain_form["inst_1-TOTAL_FORMS"] = "1"
     domain_form["inst_1-MAX_NUM_FORMS"] = ""
     domain_form["inst_1-0-id"] = ""
     domain_form["inst_1-0-DELETE"] = "False"
     domain_form["inst_1-0-language"] = "en"
     domain_form["inst_1-0-description"] = "test2"
     res = self.client.post(reverse("ispdb_add"), domain_form)
     assert_equal(res.status_code, success_code)
     model = models.EnableURL.objects.filter(url="http://test.com/")
     assert_true(model)
     model = models.EnableURL.objects.filter(url="http://test2.com/")
     assert_false(model)
     model = models.EnableURLInst.objects.filter(description="test2")
     assert_false(model)
Esempio n. 45
0
def adding_issue_form():
    form = adding_domain_form()
    form['show_form'] = 'False'
    form['title'] = 'Test'
    form['description'] = 'Test'
    return form
def adding_issue_form():
    form = adding_domain_form()
    form['show_form'] = 'False'
    form['title'] = 'Test'
    form['description'] = 'Test'
    return form