Skip to content

Conversation

@phillxnet
Copy link
Member

Modify testing code to expect new <class 'str'> in test data presented rather than our prior Py2.7 interpretation by tested code of test data as <type 'unicode'>. Other tests using the proper boolean type pass as expected so we are only looking at interpretation of invalid test data type here. And that this invalid type is being reported by tested code in a useful manner.

N.B. It is important to note that this type/class change is in play re our Py3.6 base.

Fixes #2580

Testing

Before patch

AssertionError: "Replica must be a boolean, not (<class 'str'>)." != "Replica must be a boolean, not (<type 'unicode'>)."
&
AssertionError: "Element 'uvisible' must be a boolean, not (<class 'str'>)." != "Element 'uvisible' must be a boolean, not (<type 'unicode'>)."

After patch

  • test_share.py
buildvm:/opt/rockstor/src/rockstor/storageadmin # poetry run django-admin test -v 2 -p test_shares.py
...
test_compression (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_create (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_delete_exported_replicated (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_delete_no_exports_services_snaps (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_delete_os_exception (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_delete_rock_ons_root (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_delete_with_regular_snapshot (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_get (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_name_regex (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok
test_resize (rockstor.storageadmin.tests.test_shares.ShareTests) ... ok

----------------------------------------------------------------------
Ran 10 tests in 2.870s

OK
  • test_snapshot.py
buildvm:/opt/rockstor/src/rockstor/storageadmin # poetry run django-admin test -v 2 -ptest_snapshot.py
...
test_clone_command (rockstor.storageadmin.tests.test_snapshot.SnapshotTests) ... ok
test_delete_requests (rockstor.storageadmin.tests.test_snapshot.SnapshotTests) ... ok
test_get (rockstor.storageadmin.tests.test_snapshot.SnapshotTests) ... ok
test_post_requests_1 (rockstor.storageadmin.tests.test_snapshot.SnapshotTests) ... ok
test_post_requests_2 (rockstor.storageadmin.tests.test_snapshot.SnapshotTests) ... ok

----------------------------------------------------------------------
Ran 5 tests in 0.242s

OK

Modify testing code to expect new <class 'str'> in test data
presented rather than our prior Py2.7 interpretation by tested
code of test data as <type 'unicode'>  Other tests using the
proper boolean type pass as expected so that we are only
looking at interpretation of invalid test data type here.

But it is important to note that this type/class change is
in play re our Py3.6 base.
@phillxnet phillxnet merged commit 716aa4f into rockstor:testing Jun 7, 2023
@phillxnet phillxnet deleted the 2580_Py3.6_test_shares.py_&_test_snapshot.py_re_boolean_type branch June 7, 2023 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant