コード例 #1
0
    def test_update_dependencies__use_metadata(self,
                                               mock_load_local_metadata,
                                               mock_fetch_dependencies):

        """
        TestShakerMetadata: Test we update dependencies using root metadata path
        """
        # PEP8 requires unused mock being used
        mock_load_local_metadata.return_value = None

        testobj = ShakerMetadata()
        testobj.local_requirements = {}
        testobj.root_metadata = self._sample_metadata_root

        ignore_local_requirements = False
        ignore_dependency_requirements = False
        testobj.update_dependencies(ignore_local_requirements,
                                    ignore_dependency_requirements)

        mock_fetch_dependencies.assert_called_once_with(self._sample_dependencies_root_only,
                                                        ignore_dependency_requirements)
        self.assertEqual(testobj.dependencies,
                         self._sample_dependencies_root_only,
                         'Dependencies mismatch\n'
                         'Actual:%s\nExpected:%s\n\n'
                         % (testobj.dependencies,
                            self._sample_dependencies_root_only
                            )
                         )
コード例 #2
0
    def test_update_dependencies__use_metadata(self, mock_load_local_metadata,
                                               mock_fetch_dependencies):
        """
        TestShakerMetadata: Test we update dependencies using root metadata path
        """
        # PEP8 requires unused mock being used
        mock_load_local_metadata.return_value = None

        testobj = ShakerMetadata()
        testobj.local_requirements = {}
        testobj.root_metadata = self._sample_metadata_root

        ignore_local_requirements = False
        ignore_dependency_requirements = False
        testobj.update_dependencies(ignore_local_requirements,
                                    ignore_dependency_requirements)

        mock_fetch_dependencies.assert_called_once_with(
            self._sample_dependencies_root_only,
            ignore_dependency_requirements)
        self.assertEqual(
            testobj.dependencies, self._sample_dependencies_root_only,
            'Dependencies mismatch\n'
            'Actual:%s\nExpected:%s\n\n' %
            (testobj.dependencies, self._sample_dependencies_root_only))
コード例 #3
0
    def test_update_dependencies__use_requirements(self,
                                                   mock_load_local_metadata,
                                                   mock_fetch_dependencies):

        """
        TestShakerMetadata: Test we update dependencies using root requirements path
        """
        sample_root_metadata = {
            'test_organisation/test1-formula': {
                'source': '[email protected]:test_organisation/test1-formula.git',
                'constraint': '==v1.0.1',
                'sourced_constraints': ['==v1.0.1'],
                'organisation': 'test_organisation',
                'name': 'test1-formula'
            }
        }
        sample_root_requirements = {
            'test_organisation/testa-formula': {
                'source': '[email protected]:test_organisation/testa-formula.git',
                'constraint': '==v1.0.1',
                'sourced_constraints': ['==v1.0.1'],
                'organisation': 'test_organisation',
                'name': 'testa-formula'
            }
        }

        # PEP8 requires unused mock being used
        mock_load_local_metadata.return_value = None

        testobj = ShakerMetadata()
        testobj.local_requirements = sample_root_requirements
        testobj.root_metadata = sample_root_metadata

        ignore_local_requirements = False
        ignore_dependency_requirements = False
        testobj.update_dependencies(ignore_local_requirements,
                                    ignore_dependency_requirements)

        mock_fetch_dependencies.assert_called_once_with(sample_root_requirements,
                                                        ignore_dependency_requirements)
        self.assertEqual(testobj.dependencies,
                         sample_root_requirements,
                         'Dependencies mismatch\n'
                         'Actual:%s\n'
                         'Expected:%s\n\n'
                         % (testobj.dependencies,
                            sample_root_requirements
                            )
                         )
コード例 #4
0
    def test_update_dependencies__use_requirements(self,
                                                   mock_load_local_metadata,
                                                   mock_fetch_dependencies):
        """
        TestShakerMetadata: Test we update dependencies using root requirements path
        """
        sample_root_metadata = {
            'test_organisation/test1-formula': {
                'source': '[email protected]:test_organisation/test1-formula.git',
                'constraint': '==v1.0.1',
                'sourced_constraints': ['==v1.0.1'],
                'organisation': 'test_organisation',
                'name': 'test1-formula'
            }
        }
        sample_root_requirements = {
            'test_organisation/testa-formula': {
                'source': '[email protected]:test_organisation/testa-formula.git',
                'constraint': '==v1.0.1',
                'sourced_constraints': ['==v1.0.1'],
                'organisation': 'test_organisation',
                'name': 'testa-formula'
            }
        }

        # PEP8 requires unused mock being used
        mock_load_local_metadata.return_value = None

        testobj = ShakerMetadata()
        testobj.local_requirements = sample_root_requirements
        testobj.root_metadata = sample_root_metadata

        ignore_local_requirements = False
        ignore_dependency_requirements = False
        testobj.update_dependencies(ignore_local_requirements,
                                    ignore_dependency_requirements)

        mock_fetch_dependencies.assert_called_once_with(
            sample_root_requirements, ignore_dependency_requirements)
        self.assertEqual(
            testobj.dependencies, sample_root_requirements,
            'Dependencies mismatch\n'
            'Actual:%s\n'
            'Expected:%s\n\n' %
            (testobj.dependencies, sample_root_requirements))