def test_create_change_setting_and_delete( self): # Just check there aren't any errors site.add("New", "https://test.com/", site.build_settings()) site.change_settings( "New", site.build_settings("POST", None, '{}', None, [204, 205], 'Just test', site.build_fail_actions(False, False))) site.delete("New")
def continue_f(self): if len(self.name.text()) > 3: if self.name.text() not in site.get_sites_dict().keys(): if len(self.url.text()) > 2: log.debug( 'Opening SiteSettings window for just created site \'' + self.name.text() + '\'') site.add(self.name.text(), self.url.text(), site.build_settings()) self.hide() else: QtWidgets.QMessageBox.information(self, 'Message', 'Name must be unique', QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Ok) else: QtWidgets.QMessageBox.information( self, 'Message', 'Name must be at least 4 characters long', QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Ok)
def save_all(self): log.info('Saving changed settings') proxy = None if self.text_edits[3].text() != '' or self.text_edits[4].text() != '': proxy = { 'http': self.text_edits[3].text(), 'https': self.text_edits[4].text() } site.change_settings( self.site_name, site.build_settings( self.text_edits[0].text(), json.loads(self.text_edits[1].text()), self.text_edits[2].toPlainText(), proxy, list(int(i) for i in self.text_edits[5].text().split(',')), self.text_edits[6].text(), site.build_fail_actions(self.text_edits[7].isChecked(), self.text_edits[8].isChecked()))) site.set_favourite(self.site_name, self.text_edits[9].isChecked()) site.set_site_icon(self.site_name, self.icon_path) self.close()
def test_create_rename_to_same_name_and_delete(self): site.add("New", "https://test.com/", site.build_settings()) self.assertRaises(NameError, site.rename, "New", "New") site.delete("New")
def test_create_rename_and_delete( self): # Just check there aren't any errors site.add("New", "https://test.com/", site.build_settings()) site.rename("New", "New2") site.delete("New2")
def test_double_add_and_delete_website(self): site.add("New", "https://test.com/", site.build_settings()) self.assertRaises(NameError, site.add, "New", "https://test.com/", site.build_settings()) site.delete("New")
def test_add_and_delete_website_favourite( self): # Just check there aren't any errors site.add("New", "https://test.com/", site.build_settings(), True) site.delete("New")
def test_change_setting_site_not_exists(self): self.assertRaises(NameError, site.change_settings, "New", site.build_settings())
def test_no_site(self): self.assertFalse( sites.check({ 'url': 'http://wgdgdggdg.com/', 'settings': site.build_settings() }))
def test_error(self): self.assertTrue( sites.check({ 'url': 'http://google.com/ahshhs', 'settings': site.build_settings(expected_code=[404]) }))
def test_success(self): self.assertTrue( sites.check({ 'url': 'https://google.com/', 'settings': site.build_settings() }))