From 9b64034585767d6d24d8d287380b6d4242412385 Mon Sep 17 00:00:00 2001 From: "Anders H. Rebner" <anderhre@stud.ntnu.no> Date: Thu, 2 Apr 2020 11:13:37 +0200 Subject: [PATCH] #86 Fjernet 'fi' fra authentification --- ...dule.PNG => authenticationboardmodule.PNG} | Bin .../modules/module_authentication_board.py | 24 +++++++++--------- soitool/serialize_export_import_soi.py | 2 +- test/test_module_authentication_board.py | 6 ++--- 4 files changed, 16 insertions(+), 16 deletions(-) rename soitool/media/{authentificationboardmodule.PNG => authenticationboardmodule.PNG} (100%) diff --git a/soitool/media/authentificationboardmodule.PNG b/soitool/media/authenticationboardmodule.PNG similarity index 100% rename from soitool/media/authentificationboardmodule.PNG rename to soitool/media/authenticationboardmodule.PNG diff --git a/soitool/modules/module_authentication_board.py b/soitool/modules/module_authentication_board.py index cd0bfa2..a6c8e41 100644 --- a/soitool/modules/module_authentication_board.py +++ b/soitool/modules/module_authentication_board.py @@ -31,10 +31,10 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): """Modified QTableWidget representing a 'Autentifiseringstavle'. By default, the widget initializes with a headline, a row-count of - START_NO_OF_AUTHENTIFICATION_CODES and three columns. + START_NO_OF_AUTHENTICATION_CODES and three columns. Row x in the first column contains the character ROW_IDENTIFIERS[x]. Row x in the second column contains the character x. - Row x in the third column contains an authentification code. + Row x in the third column contains an authentication code. If parameters are given, the widget initializes accordingly: 'size' is a dict: {"width": int, "height": int}, @@ -49,7 +49,7 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): """ def __init__(self, size=None, data=None): - self.type = "AuthentificationBoardModule" + self.type = "AuthenticationBoardModule" QTableWidget.__init__(self) ModuleBase.__init__(self) @@ -97,7 +97,7 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): self.insert_headline(data[0]) def generate_table(self): - """Insert row identifiers and authentification codes.""" + """Insert row identifiers and authentication codes.""" # Set number of rows and columns self.setRowCount(START_NO_OF_AUTHENTICATION_CODES) self.setColumnCount(3) @@ -145,13 +145,13 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): self.setItem(0, 0, item_headline) self.setSpan(0, 0, 1, self.columnCount()) # Make cell span all columns - def generate_unique_authentification_code(self): - """Generate authentification-code that does not already exist. + def generate_unique_authentication_code(self): + """Generate authentication-code that does not already exist. Returns ------- string - Generated, unique authentification-code + Generated, unique authentication-code """ # Get existing codes existing_codes = self.get_codes() @@ -186,7 +186,7 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): # (+ 1 to skip row containing headline) if self.rowCount() < len(ROW_IDENTIFIERS) + 1 and row_index != -1: # Generate unique code and insert row - code = self.generate_unique_authentification_code() + code = self.generate_unique_authentication_code() self.insertRow(row_index + 1) # Loop through all rows starting with the new row @@ -201,7 +201,7 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): item_second.setFlags(item_second.flags() ^ Qt.ItemIsEditable) self.setItem(i, 1, item_second) - # Insert authentification-code in third column + # Insert authentication-code in third column item_third = QTableWidgetItem(code) item_third.setFlags(item_third.flags() ^ Qt.ItemIsEditable) self.setItem(row_index + 1, 2, item_third) @@ -227,12 +227,12 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): resize_table(self, resize_column=False) def get_codes(self): - """Get all authentification-codes in table. + """Get all authentication-codes in table. Returns ------- List - List containing authentification-codes. + List containing authentication-codes. """ codes = [] @@ -276,4 +276,4 @@ class AuthenticationBoardModule(ModuleBase, QTableWidget, metaclass=Meta): @staticmethod def get_icon(): """Get icon of module.""" - return QtGui.QIcon("soitool/media/authentificationboardmodule.png") + return QtGui.QIcon("soitool/media/authenticationboardmodule.png") diff --git a/soitool/serialize_export_import_soi.py b/soitool/serialize_export_import_soi.py index a5c1dc8..f61b8f6 100644 --- a/soitool/serialize_export_import_soi.py +++ b/soitool/serialize_export_import_soi.py @@ -221,7 +221,7 @@ def import_soi(file_path): modules.append( {"widget": TableModule(size, data), "meta": module["meta"]} ) - elif module_type == "AuthentificationBoardModule": + elif module_type == "AuthenticationBoardModule": size = module["size"] data = module["data"] modules.append( diff --git a/test/test_module_authentication_board.py b/test/test_module_authentication_board.py index d5f5869..3178351 100644 --- a/test/test_module_authentication_board.py +++ b/test/test_module_authentication_board.py @@ -58,10 +58,10 @@ class TestDefaultAuthenticationBoardModule(unittest.TestCase): code_set = set(code_list) self.assertEqual(len(code_list), len(code_set)) - def test_generate_unique_authentification_code(self): - """Test function generate_unique_authentification_module.""" + def test_generate_unique_authentication_code(self): + """Test function generate_unique_authentication_module.""" code_list = self.module.get_codes() - generated_code = self.module.generate_unique_authentification_code() + generated_code = self.module.generate_unique_authentication_code() # Assert code length is equal to an existing code self.assertEqual(len(generated_code), len(code_list[0])) -- GitLab