Skip to content

Commit f8bedb1

Browse files
committed
TVB-3122. Fix Sonar warning: Unused private attributes.
1 parent 4256958 commit f8bedb1

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

tvb_framework/tvb/tests/framework/core/services/user_service_test.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
TEST_DISPLAY_NAME = "test_name"
4545
TEST_EMAIL = "[email protected]"
4646
TEST_EMAIL2 = "[email protected]"
47-
TEST_PASS = "pass"
47+
TEST_PASS = "test_pass"
4848
TEST_PASSWORD = "test_password"
4949
TEST_ROLE = "user"
5050
TEST_USER = "test_user"
@@ -131,7 +131,7 @@ def test_create_user_empty_username(self):
131131
"""
132132
Try to create a user with an empty username field.
133133
"""
134-
data = dict(username="", display_name=TEST_DISPLAY_NAME, password="test_pass", email=TEST_EMAIL, role=TEST_ROLE,
134+
data = dict(username="", display_name=TEST_DISPLAY_NAME, password=TEST_PASS, email=TEST_EMAIL, role=TEST_ROLE,
135135
comment="")
136136
with pytest.raises(UsernameException):
137137
self.user_service.create_user(**data)
@@ -140,7 +140,7 @@ def test_create_user_no_username(self):
140140
"""
141141
Try to create a user with no username data.
142142
"""
143-
data = dict(password="test_pass", display_name=TEST_DISPLAY_NAME, email=TEST_EMAIL, role=TEST_ROLE, comment="")
143+
data = dict(password=TEST_PASS, display_name=TEST_DISPLAY_NAME, email=TEST_EMAIL, role=TEST_ROLE, comment="")
144144
with pytest.raises(UsernameException):
145145
self.user_service.create_user(**data)
146146

@@ -217,7 +217,7 @@ def test_is_username_valid(self):
217217
Test the method that checks if a userName is valid or not (if it already exists
218218
in the database the userName is not valid).
219219
"""
220-
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, "test_pass", TEST_EMAIL2, False, TEST_ROLE)
220+
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, TEST_PASS, TEST_EMAIL2, False, TEST_ROLE)
221221
dao.store_entity(user)
222222
assert not self.user_service.is_username_valid(TEST_USER), "Should be False but got True"
223223
assert self.user_service.is_username_valid("test_user2"), "Should be True but got False"
@@ -226,42 +226,42 @@ def test_validate_user_happy_flow(self):
226226
"""
227227
Standard flow for a validate user action.
228228
"""
229-
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, "test_pass", TEST_EMAIL2, False, TEST_ROLE)
229+
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, TEST_PASS, TEST_EMAIL2, False, TEST_ROLE)
230230
dao.store_entity(user)
231231
assert self.user_service.validate_user(TEST_USER), "Validation failed when it shouldn't have."
232232

233233
def test_validate_user_validated(self):
234234
"""
235235
Flow for trying to validate a user that was already validated.
236236
"""
237-
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, "test_pass", TEST_EMAIL2, True, TEST_ROLE)
237+
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, TEST_PASS, TEST_EMAIL2, True, TEST_ROLE)
238238
dao.store_entity(user)
239239
assert not self.user_service.validate_user(TEST_USER), "Validation invalid."
240240

241241
def test_validate_user_non_existent(self):
242242
"""
243243
Flow for trying to validate a user that doesn't exist in the database.
244244
"""
245-
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, "test_pass", TEST_EMAIL2, True, TEST_ROLE)
245+
user = model_project.User(TEST_USER, TEST_DISPLAY_NAME, TEST_PASS, TEST_EMAIL2, True, TEST_ROLE)
246246
dao.store_entity(user)
247247
assert not self.user_service.validate_user("test_user2"), "Validation done even tho user is non-existent"
248248

249249
def test_check_login_happy_flow(self):
250250
"""
251251
Standard login flow with a valid username and password.
252252
"""
253-
user = model_project.User(TEST_USER, 'test_name', hash_password("test_pass"), TEST_EMAIL2, True,
253+
user = model_project.User(TEST_USER, 'test_name', hash_password(TEST_PASS), TEST_EMAIL2, True,
254254
TEST_ROLE)
255255
dao.store_entity(user)
256256
available_users = dao.get_all_users()
257257
assert 2 == len(available_users)
258-
assert self.user_service.check_login(TEST_USER, "test_pass") is not None, "Login failed when it shouldn't."
258+
assert self.user_service.check_login(TEST_USER, TEST_PASS) is not None, "Login failed when it shouldn't."
259259

260260
def test_check_login_bad_pass(self):
261261
"""
262262
Flow for entering a bad/invalid password.
263263
"""
264-
user = model_project.User(TEST_USER, 'test_user_name', hash_password("test_pass"), TEST_EMAIL2, True,
264+
user = model_project.User(TEST_USER, 'test_user_name', hash_password(TEST_PASS), TEST_EMAIL2, True,
265265
TEST_ROLE)
266266
dao.store_entity(user)
267267
available_users = dao.get_all_users()
@@ -272,12 +272,12 @@ def test_check_login_bad_user(self):
272272
"""
273273
Flow for entering a bad/invalid username.
274274
"""
275-
user = model_project.User(TEST_USER, 'test_name', hash_password("test_pass"), TEST_EMAIL2, True,
275+
user = model_project.User(TEST_USER, 'test_name', hash_password(TEST_PASS), TEST_EMAIL2, True,
276276
TEST_ROLE)
277277
dao.store_entity(user)
278278
available_users = dao.get_all_users()
279279
assert 2 == len(available_users)
280-
assert self.user_service.check_login("bad_user", "test_pass") is None, "Login succeeded with bad userName."
280+
assert self.user_service.check_login("bad_user", TEST_PASS) is None, "Login succeeded with bad userName."
281281

282282
def test_get_users_for_project(self):
283283
"""

tvb_storage/tvb/storage/h5/file/hdf5_storage_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class HDF5StorageManager(object):
5757
"""
5858
This class is responsible for saving / loading data in HDF5 file / format.
5959
"""
60-
__file_title_ = "TVB data file"
6160
__storage_full_name = None
6261
__hfd5_file = None
6362

@@ -77,7 +76,6 @@ def __init__(self, storage_full_name):
7776
raise FileStructureException("Please provide the file name where to store data")
7877

7978
self.__storage_full_name = storage_full_name
80-
self.__buffer_array = None
8179
self.data_buffers = {}
8280
self.data_encryption_handler = encryption_handler
8381

0 commit comments

Comments
 (0)