Changeset 1907 in products for quintagroup.seoptimizer/branches


Ignore:
Timestamp:
Mar 15, 2010 10:33:14 AM (14 years ago)
Author:
mylan
Message:

#168: Extend configlet tests for advanced fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/tests/testConfiglet.py

    r1886 r1907  
    7878            'contains: "%s", must be empty"' % str(tse)) 
    7979 
     80    def test_CustomScriptAdd(self): 
     81        expect = "<script>\n<!-- Test custom script -->\n</script>" 
     82 
     83        self.publish(self.save_url + '&form.custom_script=%s' % expect, 
     84             self.basic_auth) 
     85 
     86        cs = self.seo.getProperty("custom_script", "") 
     87        self.assertTrue(cs == expect, '"custom_script" property ' \ 
     88            'contains: "%s", but "%s" must be"' % (cs, expect)) 
     89 
     90    def test_CustomScriptDel(self): 
     91        self.publish(self.save_url + '&form.custom_script=', 
     92             self.basic_auth) 
     93 
     94        cs = self.seo.getProperty("custom_script", "") 
     95        self.assertTrue(cs == "", '"custom_script" property ' \ 
     96            'contains: "%s", must be empty"' % cs) 
     97 
     98    def test_fieldsAdd(self): 
     99        expect = ('field1', 'field2') 
     100        formdata = "\n".join(expect) 
     101        self.publish(self.save_url + '&form.fields=%s'%formdata, 
     102             self.basic_auth) 
     103 
     104        f = self.seo.getProperty("fields", ()) 
     105        self.assertTrue(f == expect, '"fields" property ' \ 
     106            'contains: "%s", must: "%s"' % (f, expect)) 
     107 
     108    def test_fieldsDel(self): 
     109        data = ('field1', 'field2') 
     110        self.seo._updateProperty("fields", data) 
     111        self.publish(self.save_url + '&form.fields=', 
     112             self.basic_auth) 
     113 
     114        f = self.seo.getProperty("fields", ()) 
     115        self.assertTrue(f == (), '"fields" property ' \ 
     116            'contains: "%s", must be empty"' % str(f)) 
     117 
     118    def test_stopWordsAdd(self): 
     119        expect = ('sw1', 'sw2', 'sw3') 
     120        formdata = "\n".join(expect) 
     121        self.publish(self.save_url + '&form.stop_words=%s'%formdata, 
     122             self.basic_auth) 
     123 
     124        f = self.seo.getProperty("stop_words", ()) 
     125        self.assertTrue(f == expect, '"stop_words" property ' \ 
     126            'contains: "%s", must: "%s"' % (f, expect)) 
     127 
     128    def test_stopWordsDel(self): 
     129        data = ('sw1', 'sw2', 'sw3') 
     130        self.seo._updateProperty("stop_words", data) 
     131        self.publish(self.save_url + '&form.stop_words=', 
     132             self.basic_auth) 
     133 
     134        f = self.seo.getProperty("stop_words", ()) 
     135        self.assertTrue(f == (), '"stop_words" property ' \ 
     136            'contains: "%s", must be empty"' % str(f)) 
     137 
    80138 
    81139def test_suite(): 
Note: See TracChangeset for help on using the changeset viewer.