def test_flags(self): installer_mock = Mock(spec=installer.Installer) flags1 = fomod.Flags() flags1["flag1"] = "value1" flags2 = fomod.Flags() flags2["flag2"] = "value2" flags3 = fomod.Flags() flags3["flag1"] = "value3" option1 = fomod.Option() option1.flags = flags1 option2 = fomod.Option() option2.flags = flags2 option3 = fomod.Option() option3.flags = flags3 installer_mock._previous_pages = [ installer.PageInfo( None, [installer.InstallerOption(installer_mock, option1)]), installer.PageInfo( None, [ installer.InstallerOption(installer_mock, option2), installer.InstallerOption(installer_mock, option3), ], ), ] expected = {"flag1": "value3", "flag2": "value2"} assert installer.Installer.flags(installer_mock) == expected
def test_to_string(self): self.option.name = "boo" self.option.description = "bee" self.option.image = "path" self.option.type = fomod.OptionType.RECOMMENDED files = fomod.Files() files["src"] = "dst" files_text = files.to_string() self.option.files = files flags = fomod.Flags() flags["flag"] = "value" flags_text = flags.to_string() self.option.flags = flags expected = textwrap.dedent("""\ <plugin name="boo"> <description>bee</description> <image path="path"/> {} {} <typeDescriptor> <type name="Recommended"/> </typeDescriptor> </plugin>""".format( textwrap.indent(files_text, " " * 4 + " "), textwrap.indent(flags_text, " " * 4 + " "), )) assert self.option.to_string() == expected
def test_flags(self): installer_mock = Mock(spec=installer.Installer) flags1 = fomod.Flags() flags1["flag1"] = "value1" flags2 = fomod.Flags() flags2["flag2"] = "value2" flags3 = fomod.Flags() flags3["flag1"] = "value3" option1 = fomod.Option() option1.flags = flags1 option2 = fomod.Option() option2.flags = flags2 option3 = fomod.Option() option3.flags = flags3 installer_mock._previous_pages = OrderedDict([(None, [option1]), (None, [option2, option3])]) expected = {"flag1": "value3", "flag2": "value2"} assert installer.Installer.flags(installer_mock) == expected
def setup_method(self): self.flags = fomod.Flags()
def test_flags(self): test = fomod.Flags() self.option.flags = test assert self.option.flags is test assert self.option._flags is test