cloudcomputinghust/CAL

View on GitHub
calplus/tests/unit/v1/object_storage/test_client.py

Summary

Maintainability
F
4 days
Test Coverage

File test_client.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import mock

from calplus.exceptions import DriverException
from calplus.tests import base
from calplus.v1.object_storage import client
Severity: Minor
Found in calplus/tests/unit/v1/object_storage/test_client.py - About 2 hrs to fix

    TestClient has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TestClient(base.TestCase):
    
        """Unittest for Object Storage Client"""
    
        def setUp(self):
    Severity: Minor
    Found in calplus/tests/unit/v1/object_storage/test_client.py - About 2 hrs to fix

      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_client.driver,
                  'copy_object',
                  mock.Mock(return_value='copy successfully')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 1 other location - About 3 hrs to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 264..277

      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_another_container_successfully(self):
              self.mock_object(
                  self.fake_client.driver,
                  'copy_object',
                  mock.Mock(return_value='copy successfully')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 1 other location - About 3 hrs to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 246..259

      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 4 locations. Consider refactoring.
      Open

          def test_delete_object_successfully(self):
              self.mock_object(
                  self.fake_client.driver,
                  'delete_object',
                  mock.Mock(return_value='delete successfully')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 3 other locations - About 2 hrs to fix
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 217..229
      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

      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 4 locations. Consider refactoring.
      Open

          def test_download_object_successfully(self):
              self.mock_object(
                  self.fake_client.driver,
                  'download_object',
                  mock.Mock(return_value='download object successfully')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 3 other locations - About 2 hrs to fix
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 217..229
      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 4 locations. Consider refactoring.
      Open

          def test_stat_object_successfully(self):
              self.mock_object(
                  self.fake_client.driver,
                  'stat_object',
                  mock.Mock(return_value='object\'s stat')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 3 other locations - About 2 hrs to fix
      calplus/tests/unit/v1/object_storage/drivers/test_openstack_driver.py on lines 217..229
      calplus/tests/unit/v1/object_storage/test_client.py on lines 163..174
      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 3 locations. Consider refactoring.
      Open

          def test_delete_container_successfully(self):
              self.mock_object(
                  self.fake_client.driver,
                  'delete_container',
                  mock.Mock(return_value='return object')
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 2 hrs to fix
      calplus/tests/unit/v1/compute/test_client.py on lines 61..68
      calplus/tests/unit/v1/object_storage/test_client.py on lines 30..37

      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 3 locations. Consider refactoring.
      Open

          def test_create_container_successfully(self):
              self.mock_object(
                  self.fake_client.driver, 'create_container',
                  mock.Mock(return_value='return object')
              )
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 2 hrs to fix
      calplus/tests/unit/v1/compute/test_client.py on lines 61..68
      calplus/tests/unit/v1/object_storage/test_client.py on lines 50..58

      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 3 locations. Consider refactoring.
      Open

          def test_stat_object_failed(self):
              self.mock_object(
                  self.fake_client,
                  'stat_object',
                  mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 176..187
      calplus/tests/unit/v1/object_storage/test_client.py on lines 232..243

      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 45.

      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_client,
                  'download_object',
                  mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 205..216
      calplus/tests/unit/v1/object_storage/test_client.py on lines 232..243

      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 45.

      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_client,
                  'delete_object',
                  mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 176..187
      calplus/tests/unit/v1/object_storage/test_client.py on lines 205..216

      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 45.

      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_container_failed(self):
                  self.mock_object(
                      self.fake_client,
                      'stat_container',
                      mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 40..48
      calplus/tests/unit/v1/object_storage/test_client.py on lines 61..69

      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 44.

      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_container_failed(self):
              self.mock_object(
                  self.fake_client,
                  'delete_container',
                  mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 40..48
      calplus/tests/unit/v1/object_storage/test_client.py on lines 82..91

      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 44.

      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_create_container_failed(self):
              self.mock_object(
                  self.fake_client,
                  'create_container',
                  mock.Mock(side_effect=DriverException())
      Severity: Major
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 1 hr to fix
      calplus/tests/unit/v1/object_storage/test_client.py on lines 61..69
      calplus/tests/unit/v1/object_storage/test_client.py on lines 82..91

      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 44.

      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 setUp(self):
              super(TestClient, self).setUp()
              self.fake_client = client.Client('OpenStack',
                                               fake_config_driver)
      Severity: Minor
      Found in calplus/tests/unit/v1/object_storage/test_client.py and 2 other locations - About 30 mins to fix
      calplus/tests/unit/v1/compute/test_client.py on lines 31..34
      calplus/tests/unit/v1/network/test_client.py on lines 87..90

      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 32.

      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