Beispiel #1
0
 def testGetHtmlItemHasContainedItemsIncludesSelected(self):
     subSubItem = NavigatorItem(pageId="asdgasgsa", text="Sub-sub-item")
     subItems = []
     subItems.append(
         NavigatorItem(pageId="aasaassasa",
                       text="Sub-item 1",
                       items=[subSubItem]))
     subItems.append(NavigatorItem(pageId="asasdasfa", text="Sub-item 2"))
     item = NavigatorItem(pageId="hello",
                          text="Hello",
                          params={"hello": 0},
                          items=subItems)
     page = self.getPage("asdgasgsa", {"session": "12412"})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <a href="/cgi-bin/page.py?id=hello&session=12412&hello=0">Hello</a>
         <ul id="currentMenu">
             <li>
                 <a href="/cgi-bin/page.py?id=aasaassasa&session=12412">Sub-item 1</a>
                 <ul id="currentMenu">
                     <li>
                         <span class="current">Sub-sub-item</span>
                     </li>
                 </ul>
             </li>
             <li>
                 <a href="/cgi-bin/page.py?id=asasdasfa&session=12412">Sub-item 2</a>
             </li>
         </ul>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #2
0
 def testGetHtmlItemHasContainedItemsIncludesSelected(self):
     subSubItem = NavigatorItem(pageId="asdgasgsa", text="Sub-sub-item")
     subItems = []
     subItems.append(NavigatorItem(pageId="aasaassasa", text="Sub-item 1", items=[subSubItem]))
     subItems.append(NavigatorItem(pageId="asasdasfa", text="Sub-item 2"))
     item = NavigatorItem(pageId="hello", text="Hello", params={"hello": 0}, items=subItems)
     page = self.getPage("asdgasgsa", {"session": "12412"})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <a href="/cgi-bin/page.py?id=hello&session=12412&hello=0">Hello</a>
         <ul id="currentMenu">
             <li>
                 <a href="/cgi-bin/page.py?id=aasaassasa&session=12412">Sub-item 1</a>
                 <ul id="currentMenu">
                     <li>
                         <span class="current">Sub-sub-item</span>
                     </li>
                 </ul>
             </li>
             <li>
                 <a href="/cgi-bin/page.py?id=asasdasfa&session=12412">Sub-item 2</a>
             </li>
         </ul>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #3
0
 def testGetHtmlItemIsCurrentHasNoContainedItems(self):
     item = NavigatorItem(pageId="hello", text="Hello", params={"hello": 0})
     page = self.getPage("hello", {"hello": 0})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <span class="current">Hello</span>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #4
0
 def testGetHtmlItemIsNotCurrentHasNoContainedItemsNoSession(self):
     item = NavigatorItem(pageId="hello", text="Hello", params={"hello": 0})
     page = self.getPage("afaasfsa")
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <a href="/cgi-bin/page.py?id=hello&hello=0">Hello</a>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #5
0
 def testGetHtmlItemIsCurrentHasNoContainedItems(self):
     item = NavigatorItem(pageId="hello", text="Hello", params={"hello": 0})
     page = self.getPage("hello", {"hello": 0})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <span class="current">Hello</span>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #6
0
 def testGetHtmlItemIsNotCurrentHasNoContainedItemsNoSession(self):
     item = NavigatorItem(pageId="hello", text="Hello", params={"hello": 0})
     page = self.getPage("afaasfsa")
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <a href="/cgi-bin/page.py?id=hello&hello=0">Hello</a>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #7
0
 def testGetHtmlItemHasContainedItemsIsSelected(self):
     subItems = []
     subItems.append(NavigatorItem(pageId="aasda", text="Item1"))
     subItems.append(NavigatorItem(pageId="aadsgasgas", text="Item2"))
     item = NavigatorItem(pageId="aadgas", text="Hello", params={"hello": 0}, items=subItems)
     page = self.getPage("aadgas", params={"hello": 0, "session": "12412"})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <span class="current">Hello</span>
         <ul id="currentMenu">
             <li>
                 <a href="/cgi-bin/page.py?id=aasda&session=12412">Item1</a>
             </li>
             <li>
                 <a href="/cgi-bin/page.py?id=aadsgasgas&session=12412">Item2</a>
             </li>
         </ul>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)
Beispiel #8
0
 def testGetHtmlItemHasContainedItemsIsSelected(self):
     subItems = []
     subItems.append(NavigatorItem(pageId="aasda", text="Item1"))
     subItems.append(NavigatorItem(pageId="aadsgasgas", text="Item2"))
     item = NavigatorItem(pageId="aadgas",
                          text="Hello",
                          params={"hello": 0},
                          items=subItems)
     page = self.getPage("aadgas", params={"hello": 0, "session": "12412"})
     result = item.getHtml(page)
     expectedResult = """
     <li>
         <span class="current">Hello</span>
         <ul id="currentMenu">
             <li>
                 <a href="/cgi-bin/page.py?id=aasda&session=12412">Item1</a>
             </li>
             <li>
                 <a href="/cgi-bin/page.py?id=aadsgasgas&session=12412">Item2</a>
             </li>
         </ul>
     </li>
     """
     self.assertMultiLineEqual(expectedResult, result)