<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -577,6 +577,39 @@ class ServerTester:
         assert 'pofilename=test_nav_url.po' in parameters
         assert 'item=1' in parameters
 
+    def test_search(self):
+        &quot;&quot;&quot;Test the searching functionality when results are and are not expected.&quot;&quot;&quot;
+        self.login()
+
+        # Create initial .po file
+        podir = self.setup_testproject_dir(perms='view')
+        pofile_storename = os.path.join(podir, &quot;test_upload.po&quot;)
+        pocontents = '#: test.c\nmsgid &quot;test&quot;\nmsgstr &quot;rest&quot;\n'
+        open(pofile_storename, &quot;w&quot;).write(pocontents)
+
+        test_translation_string = '&lt;div class=&quot;translation-text&quot;&gt;test&lt;/div&gt;'
+        # Test for existing results
+        fields = {
+            'searchtext': 'test',
+            'pofilename': 'test_upload.po',
+            'source': '1'
+        }
+        content_type, post_contents = encode_multipart_formdata(fields.items(), [])
+        headers = { 'Content-Type': content_type, 'Content-Length': len(post_contents) }
+        translatepage = self.post_request('zxx/testproject/translate.html', post_contents, headers)
+        assert test_translation_string in translatepage
+
+        # Test for empty result
+        fields = {
+            'searchtext': 'test',
+            'pofilename': 'test_upload.po',
+            'target': '1'
+        }
+        content_type, post_contents = encode_multipart_formdata(fields.items(), [])
+        headers = { 'Content-Type': content_type, 'Content-Length': len(post_contents) }
+        translatepage = self.post_request('zxx/testproject/translate.html', post_contents, headers)
+        assert test_translation_string not in translatepage
+
 def MakeServerTester(baseclass):
     &quot;&quot;&quot;Makes a new Server Tester class using the base class to setup webserver etc.&quot;&quot;&quot;
     class TestServer(baseclass, ServerTester):</diff>
      <filename>test_client.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>60fc66066779cda34aa4ef8519407dacffb96936</id>
    </parent>
  </parents>
  <author>
    <name>walter_l</name>
    <email>walter_l@54714841-351b-0410-a198-e36a94b762f5</email>
  </author>
  <url>http://github.com/julen/pootle/commit/1b2de810389aff7cd9886cb120242669c02b5b0e</url>
  <id>1b2de810389aff7cd9886cb120242669c02b5b0e</id>
  <committed-date>2008-10-22T08:04:07-07:00</committed-date>
  <authored-date>2008-10-22T08:04:07-07:00</authored-date>
  <message>Added a basic test case to test the search functionality.


git-svn-id: https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/Pootle@8825 54714841-351b-0410-a198-e36a94b762f5</message>
  <tree>0963d243cadde6b09faa89cb0308fb2e1eb3f69d</tree>
  <committer>
    <name>walter_l</name>
    <email>walter_l@54714841-351b-0410-a198-e36a94b762f5</email>
  </committer>
</commit>
