Esempio n. 1
0
    def test_remove_invalid_source_valid_type(self):
        """
        Test source removal from manager memory with an invalid proxy source
        and a valid proxy type
        """
        path = 'test/sample_proxysources/valid_metadata'
        os.environ['PROXY_PATH'] = path
        types = ValidMetadataSource.metadata.get('type')

        m = ProxySourceManager()
        for t in types:
            m.remove_source(source_name='not_the_correct_name', proxy_type=t)
            self.assertEqual(len(m.proxies_per_type.get(t)), 1)
Esempio n. 2
0
    def test_remove_valid_source_valid_type(self):
        """
        Test source removal from manager memory, happy path
        """
        name = 'valid_metadata'
        path = 'test/sample_proxysources/valid_metadata'
        os.environ['PROXY_PATH'] = path
        types = ValidMetadataSource.metadata.get('type')

        m = ProxySourceManager()

        for t in types:
            m.remove_source(source_name=name, proxy_type=t)
            self.assertEqual(len(m.proxies_per_type.get(t)), 0)
Esempio n. 3
0
    def test_remove_valid_source_invalid_type(self):
        """
        Test source removal from manager memory with an invalid proxy type and
        a valid source
        """
        name = 'valid_metadata'
        path = 'test/sample_proxysources/' + name
        os.environ['PROXY_PATH'] = path
        incorrect_type = 'invalid_proxy_type'
        correct_types = ValidMetadataSource.metadata.get('type')

        m = ProxySourceManager()
        m.remove_source(source_name=name, proxy_type=incorrect_type)
        for t in correct_types:
            self.assertEqual(len(m.proxies_per_type.get(t)), 1)