cloudcomputinghust/CAL

View on GitHub
calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py

Summary

Maintainability
F
5 days
Test Coverage

File test_openstack_driver.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""OpenstackDriver for ObjectStorage
based on BaseDriver for ObjectStorage Resource
"""

Severity: Minor
Found in calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py - About 4 hrs to fix

    OpenStackDriverTest has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OpenStackDriverTest(base.TestCase):
        """Testing for OpenStackDriver"""
    
        def setUp(self):
            super(OpenStackDriverTest, self).setUp()
    Severity: Minor
    Found in calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_copy_object_in_another_container_successfully(self):
              self.mock_object(
                  self.fake_driver.client,
                  'copy_object',
                  mock.Mock(return_value=None)
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 319..332

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 71.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_copy_object_in_same_container_successfully(self):
              self.mock_object(
                  self.fake_driver.client,
                  'copy_object',
                  mock.Mock(return_value=None)
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 337..350

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 71.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_download_object_failed(self):
              self.mock_object(
                  self.fake_driver.client,
                  'get_object',
                  mock.Mock(side_effect=ClientException(
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 266..282
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 300..316

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 65.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_delete_object_failed(self):
              self.mock_object(
                  self.fake_driver.client,
                  'delete_object',
                  mock.Mock(side_effect=ClientException(
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 232..248
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 266..282

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 65.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def test_stat_object_failed(self):
              self.mock_object(
                  self.fake_driver.client,
                  'head_object',
                  mock.Mock(side_effect=ClientException(
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 232..248
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 300..316

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 65.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_stat_container_failed(self):
              self.mock_object(
                  self.fake_driver.client,
                  'head_container',
                  mock.Mock(side_effect=ClientException(
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 98..110

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def test_delete_container_failed(self):
              self.mock_object(
                  self.fake_driver.client,
                  'delete_container',
                  mock.Mock(side_effect=ClientException(
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 122..134

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          def test_download_object_successfully(self):
              self.mock_object(
                  self.fake_driver.client,
                  'get_object',
                  mock.Mock(return_value='fake-body')
      calplus/tests/unit/v1/object_storage/test_client.py on lines 163..174
      calplus/tests/unit/v1/object_storage/test_client.py on lines 190..203
      calplus/tests/unit/v1/object_storage/test_client.py on lines 219..230

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def test_stat_object_successfully(self):
              self.mock_object(
                  self.fake_driver.client,
                  'head_object',
                  mock.Mock(return_value=fake_stat_object_resp)
      calplus/tests/unit/v1/compute/test_client.py on lines 187..197
      calplus/tests/unit/v1/compute/test_client.py on lines 212..222
      calplus/tests/unit/v1/compute/test_client.py on lines 237..247
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 285..297

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def test_delete_object_successfully(self):
              self.mock_object(
                  self.fake_driver.client,
                  'delete_object',
                  mock.Mock(return_value=None)
      calplus/tests/unit/v1/compute/test_client.py on lines 187..197
      calplus/tests/unit/v1/compute/test_client.py on lines 212..222
      calplus/tests/unit/v1/compute/test_client.py on lines 237..247
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 251..263

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 13 locations. Consider refactoring.
      Open

          def test_create_container_successfully(self):
              self.mock_object(self.fake_driver.client, 'put_container',
                               mock.Mock(return_value=None))
              # NOTE: in fact, mock.Mock is swiftclient.client.Connection
      
      calplus/tests/unit/v1/compute/test_client.py on lines 103..110
      calplus/tests/unit/v1/compute/test_client.py on lines 124..131
      calplus/tests/unit/v1/compute/test_client.py on lines 145..152
      calplus/tests/unit/v1/compute/test_client.py on lines 166..173
      calplus/tests/unit/v1/compute/test_client.py on lines 262..269
      calplus/tests/unit/v1/compute/test_client.py on lines 308..316
      calplus/tests/unit/v1/compute/test_client.py on lines 330..337
      calplus/tests/unit/v1/network/test_client.py on lines 188..196
      calplus/tests/unit/v1/network/test_client.py on lines 210..218
      calplus/tests/unit/v1/network/test_client.py on lines 274..281
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 89..95
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 113..119

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 13 locations. Consider refactoring.
      Open

          def test_delete_container_successfully(self):
              self.mock_object(self.fake_driver.client, 'delete_container',
                               mock.Mock(return_value=None))
              # NOTE: in fact, mock.Mock is swiftclient.client.Connection
      
      calplus/tests/unit/v1/compute/test_client.py on lines 103..110
      calplus/tests/unit/v1/compute/test_client.py on lines 124..131
      calplus/tests/unit/v1/compute/test_client.py on lines 145..152
      calplus/tests/unit/v1/compute/test_client.py on lines 166..173
      calplus/tests/unit/v1/compute/test_client.py on lines 262..269
      calplus/tests/unit/v1/compute/test_client.py on lines 308..316
      calplus/tests/unit/v1/compute/test_client.py on lines 330..337
      calplus/tests/unit/v1/network/test_client.py on lines 188..196
      calplus/tests/unit/v1/network/test_client.py on lines 210..218
      calplus/tests/unit/v1/network/test_client.py on lines 274..281
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 76..82
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 113..119

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 13 locations. Consider refactoring.
      Open

          def test_stat_container_successfully(self):
              self.mock_object(self.fake_driver.client, 'head_container',
                               mock.Mock(return_value=fake_stat_container_resp))
              # NOTE: in fact, mock.Mock is swiftclient.client.Connection
      
      calplus/tests/unit/v1/compute/test_client.py on lines 103..110
      calplus/tests/unit/v1/compute/test_client.py on lines 124..131
      calplus/tests/unit/v1/compute/test_client.py on lines 145..152
      calplus/tests/unit/v1/compute/test_client.py on lines 166..173
      calplus/tests/unit/v1/compute/test_client.py on lines 262..269
      calplus/tests/unit/v1/compute/test_client.py on lines 308..316
      calplus/tests/unit/v1/compute/test_client.py on lines 330..337
      calplus/tests/unit/v1/network/test_client.py on lines 188..196
      calplus/tests/unit/v1/network/test_client.py on lines 210..218
      calplus/tests/unit/v1/network/test_client.py on lines 274..281
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 76..82
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 89..95

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status