def test_repr_deveria_conter_nome_da_instancia(self): menu_item = widget.MenuItem(name="name", url="url") self.assertEqual("MenuItem (name=name, url=url)", repr(menu_item))
def test_render_deveria_retornar_html(self): html = '<li><a href="url">name</a></li>' menu_item = widget.MenuItem(name="name", url="url") self.assertEqual(html, menu_item.render())
def test_add_deveria_criar_menu_item_e_adicionar_ao_items(self): menu = self.menu("Name") menu.add("name", "url") self.assertListEqual([widget.MenuItem("name", "url")], menu.items)
def test_init_deveria_criar_atributos_name_e_url(self): menu_item = widget.MenuItem(name="name", url="url") self.assertEqual("name", menu_item.name) self.assertEqual("url", menu_item.url)
def test_add_many_deveria_construir_menu_items_e_adicionar_ao_items(self): menu = self.menu("Name") menu.add_many(*[("name", "url")]) self.assertListEqual([widget.MenuItem("name", "url")], menu.items)