Exemplo n.º 1
0
    def test_update_when_repo_modified_on_mutable(self, mock_get_repo_file_classes):
        self._inject_mock_invalid_consumer()
        modified_repo = Repo('x', [('gpgcheck', 'unoriginal'), ('gpgkey', 'some_key')])
        server_repo = Repo('x', [('gpgcheck', 'original')])
        mock_file = MagicMock()
        mock_file.CONTENT_TYPES = [None]
        mock_file.fix_content = lambda x: x
        mock_file.section.side_effect = [modified_repo, server_repo]
        mock_class = MagicMock(return_value=mock_file)
        mock_get_repo_file_classes.return_value = [(mock_class, mock_class)]

        def stub_content():
            return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key'), ('name', 'test')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        current = update_action.perform()
        # confirming that the assessed value does not change when repo file
        # is different from the server value file.
        self.assertEqual('unoriginal', current.repo_updates[0]['gpgcheck'])

        # this is the ending server value file
        written_repo = mock_file.update.call_args[0][0]
        self.assertEqual('new', written_repo['gpgcheck'])
        self.assertEqual(None, written_repo['gpgkey'])
    def test_update_when_repo_not_modified_on_mutable(self, mock_file):
        self._inject_mock_invalid_consumer()
        mock_file = mock_file.return_value
        modified_repo = Repo('x', [('gpgcheck', 'original'),
                                   ('gpgkey', 'some_key')])
        server_repo = Repo('x', [('gpgcheck', 'original')])
        mock_file.section = MagicMock(side_effect=[modified_repo, server_repo])

        def stub_content():
            return [
                Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key'),
                           ('name', 'test')])
            ]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        current = update_action.perform()
        # confirming that the assessed value does change when repo file
        # is the same as the server value file.
        self.assertEqual('new', current.repo_updates[0]['gpgcheck'])

        # this is the ending server value file.
        written_repo = mock_file.update.call_args[0][0]
        self.assertEqual('new', written_repo['gpgcheck'])
        self.assertEqual(None, written_repo['gpgkey'])
 def test_ui_repoid_vars(self):
     update_action = RepoUpdateActionCommand()
     content = update_action.get_all_content(baseurl="http://example.com", ca_cert=None)
     c4 = self._find_content(content, "c4")
     self.assertEquals("some path", c4["ui_repoid_vars"])
     c2 = self._find_content(content, "c2")
     self.assertEquals(None, c2["ui_repoid_vars"])
Exemplo n.º 4
0
 def test_only_allow_content_of_type_yum(self):
     update_action = RepoUpdateActionCommand()
     content = update_action.get_all_content(baseurl="http://example.com",
                                             ca_cert=None)
     self.assertTrue(self._find_content(content, "c1") is not None)
     self.assertTrue(self._find_content(content, "c5") is None)
     self.assertTrue(self._find_content(content, "c6") is None)
    def test_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_all_content(baseurl="http://example.com", ca_cert=None)
        c4 = self._find_content(content, "c4")
        self.assertEquals("http://example.com/gpg.key", c4["gpgkey"])
        self.assertEquals("1", c4["gpgcheck"])
Exemplo n.º 6
0
 def test_unset_mutable_property(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     incoming_repo = {'metadata_expire': 2000}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual(2000, existing_repo['metadata_expire'])
Exemplo n.º 7
0
 def test_unset_immutable_property(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     incoming_repo = {'name': "woof"}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual("woof", existing_repo['name'])
Exemplo n.º 8
0
    def test_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_content(self.stub_ent_cert,
                                            "http://example.com", None)
        c4 = self._find_content(content, 'c4')
        self.assertEquals('http://example.com/gpg.key', c4['gpgkey'])
        self.assertEquals('1', c4['gpgcheck'])
 def test_immutable_property(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo("testrepo")
     existing_repo["name"] = "meow"
     incoming_repo = {"name": "woof"}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual("woof", existing_repo["name"])
Exemplo n.º 10
0
 def test_mutable_property(self):
     update_action = RepoUpdateActionCommand()
     self._inject_mock_invalid_consumer()
     existing_repo = Repo("testrepo")
     existing_repo["metadata_expire"] = 1000
     incoming_repo = {"metadata_expire": 2000}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual(1000, existing_repo["metadata_expire"])
Exemplo n.º 11
0
 def test_ui_repoid_vars(self):
     update_action = RepoUpdateActionCommand()
     content = update_action.get_content(self.stub_ent_cert,
                                         "http://example.com", None)
     c4 = self._find_content(content, 'c4')
     self.assertEquals('some path', c4['ui_repoid_vars'])
     c2 = self._find_content(content, 'c2')
     self.assertEquals(None, c2['ui_repoid_vars'])
Exemplo n.º 12
0
    def test_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_content(self.stub_ent_cert,
                                            "http://example.com", None)
        c4 = self._find_content(content, 'c4')
        self.assertEquals('http://example.com/gpg.key', c4['gpgkey'])
        self.assertEquals('1', c4['gpgcheck'])
Exemplo n.º 13
0
 def test_overrides_trump_ent_cert(self):
     update_action = RepoUpdateActionCommand()
     update_action.overrides = {"x": {"gpgcheck": "blah"}}
     r = Repo("x", [("gpgcheck", "original"), ("gpgkey", "some_key")])
     self.assertEquals("original", r["gpgcheck"])
     update_action._set_override_info(r)
     self.assertEquals("blah", r["gpgcheck"])
     self.assertEquals("some_key", r["gpgkey"])
Exemplo n.º 14
0
 def test_ui_repoid_vars(self):
     update_action = RepoUpdateActionCommand()
     content = update_action.get_all_content(baseurl="http://example.com",
                                         ca_cert=None)
     c4 = self._find_content(content, 'c4')
     self.assertEqual('some path', c4['ui_repoid_vars'])
     c2 = self._find_content(content, 'c2')
     self.assertEqual(None, c2['ui_repoid_vars'])
Exemplo n.º 15
0
 def test_set_immutable_property_now_empty(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     existing_repo['proxy_username'] = "******"
     incoming_repo = {}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertFalse("proxy_username" in list(existing_repo.keys()))
Exemplo n.º 16
0
 def test_gpgcheck_is_mutable(self):
     update_action = RepoUpdateActionCommand()
     self._inject_mock_invalid_consumer()
     existing_repo = Repo('testrepo')
     existing_repo['gpgcheck'] = "0"
     incoming_repo = {'gpgcheck': "1"}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual("0", existing_repo['gpgcheck'])
Exemplo n.º 17
0
 def test_overrides_trump_ent_cert(self):
     update_action = RepoUpdateActionCommand()
     update_action.overrides = {'x': {'gpgcheck': 'blah'}}
     r = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
     self.assertEqual('original', r['gpgcheck'])
     update_action._set_override_info(r)
     self.assertEqual('blah', r['gpgcheck'])
     self.assertEqual('some_key', r['gpgkey'])
Exemplo n.º 18
0
    def test_repo_update_forbidden_when_registered(self):
        existing_repo = Repo('testrepo')
        existing_repo['proxy_username'] = "******"
        incoming_repo = {'proxy_username': '******'}

        update_action = RepoUpdateActionCommand()
        update_action.override_supported = True
        self.assertRaises(UnsupportedOperationException, update_action.update_repo, existing_repo, incoming_repo)
Exemplo n.º 19
0
 def test_mutable_property_in_repo_but_not_in_cert(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     existing_repo['metadata_expire'] = 1000
     incoming_repo = {}
     update_action.update_repo(existing_repo, incoming_repo)
     self.assertEqual(1000, existing_repo['metadata_expire'])
Exemplo n.º 20
0
    def test_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_all_content(baseurl="http://example.com",
                                                ca_cert=None)
        c4 = self._find_content(content, 'c4')
        self.assertEqual('http://example.com/gpg.key', c4['gpgkey'])
        self.assertEqual('1', c4['gpgcheck'])
Exemplo n.º 21
0
 def test_ui_repoid_vars(self):
     update_action = RepoUpdateActionCommand()
     content = update_action.get_content(self.stub_ent_cert,
                                         "http://example.com", None)
     c4 = self._find_content(content, 'c4')
     self.assertEquals('some path', c4['ui_repoid_vars'])
     c2 = self._find_content(content, 'c2')
     self.assertEquals(None, c2['ui_repoid_vars'])
Exemplo n.º 22
0
    def test_repo_update_forbidden_when_registered(self):
        existing_repo = Repo('testrepo')
        existing_repo['proxy_username'] = "******"
        incoming_repo = {'proxy_username': '******'}

        update_action = RepoUpdateActionCommand()
        update_action.override_supported = True
        self.assertRaises(UnsupportedOperationException,
                          update_action.update_repo, existing_repo,
                          incoming_repo)
Exemplo n.º 23
0
 def test_set_immutable_property_now_not_in_cert(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     existing_repo['proxy_username'] = "******"
     incoming_repo = {}
     update_action.update_repo(existing_repo, incoming_repo)
     # Immutable properties should be always be added/updated,
     # and removed if undefined in the new repo definition.
     self.assertFalse("proxy_username" in list(existing_repo.keys()))
Exemplo n.º 24
0
 def test_mutable_property_is_server(self):
     update_action = RepoUpdateActionCommand()
     self._inject_mock_invalid_consumer()
     existing_repo = Repo('testrepo')
     server_val_repo = Repo('servertestrepo')
     existing_repo['metadata_expire'] = 1000
     server_val_repo['metadata_expire'] = 1000
     incoming_repo = {'metadata_expire': 2000}
     update_action.update_repo(existing_repo, incoming_repo, server_val_repo)
     self.assertEqual(2000, existing_repo['metadata_expire'])
Exemplo n.º 25
0
 def test_overrides_trump_ent_cert(self):
     update_action = RepoUpdateActionCommand()
     update_action.overrides = [{'contentLabel': 'x',
                                 'name': 'gpgcheck',
                                 'value': 'blah'}]
     r = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
     self.assertEquals('original', r['gpgcheck'])
     update_action._set_override_info(r)
     self.assertEquals('blah', r['gpgcheck'])
     self.assertEquals('some_key', r['gpgkey'])
Exemplo n.º 26
0
 def test_set_mutable_property_now_not_in_cert(self):
     self._inject_mock_invalid_consumer()
     update_action = RepoUpdateActionCommand()
     existing_repo = Repo('testrepo')
     existing_repo['metadata_expire'] = "blah"
     incoming_repo = {}
     update_action.update_repo(existing_repo, incoming_repo)
     # re comments in repolib
     # Mutable properties should be added if not currently defined,
     # otherwise left alone.
     self.assertTrue("metadata_expire" in list(existing_repo.keys()))
Exemplo n.º 27
0
    def test_no_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_all_content(baseurl="http://example.com", ca_cert=None)
        c1 = self._find_content(content, "c1")
        self.assertEquals("", c1["gpgkey"])
        self.assertEquals("0", c1["gpgcheck"])

        c2 = self._find_content(content, "c2")
        self.assertEquals("", c2["gpgkey"])
        self.assertEquals("0", c2["gpgcheck"])
Exemplo n.º 28
0
 def test_overrides_trump_ent_cert(self):
     update_action = RepoUpdateActionCommand()
     update_action.overrides = [{
         'contentLabel': 'x',
         'name': 'gpgcheck',
         'value': 'blah'
     }]
     r = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
     self.assertEquals('original', r['gpgcheck'])
     update_action._set_override_info(r)
     self.assertEquals('blah', r['gpgcheck'])
     self.assertEquals('some_key', r['gpgkey'])
Exemplo n.º 29
0
    def test_no_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_content(self.stub_ent_cert,
                                            "http://example.com", None)
        c1 = self._find_content(content, 'c1')
        self.assertEquals('', c1['gpgkey'])
        self.assertEquals('0', c1['gpgcheck'])

        c2 = self._find_content(content, 'c2')
        self.assertEquals('', c2['gpgkey'])
        self.assertEquals('0', c2['gpgcheck'])
Exemplo n.º 30
0
    def test_no_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_all_content(baseurl="http://example.com",
                                                ca_cert=None)
        c1 = self._find_content(content, 'c1')
        self.assertEqual('', c1['gpgkey'])
        self.assertEqual('0', c1['gpgcheck'])

        c2 = self._find_content(content, 'c2')
        self.assertEqual('', c2['gpgkey'])
        self.assertEqual('0', c2['gpgcheck'])
Exemplo n.º 31
0
    def test_no_gpg_key(self):

        update_action = RepoUpdateActionCommand()
        content = update_action.get_content(self.stub_ent_cert,
                                            "http://example.com", None)
        c1 = self._find_content(content, 'c1')
        self.assertEquals('', c1['gpgkey'])
        self.assertEquals('0', c1['gpgcheck'])

        c2 = self._find_content(content, 'c2')
        self.assertEquals('', c2['gpgkey'])
        self.assertEquals('0', c2['gpgcheck'])
Exemplo n.º 32
0
    def test_update_when_new_repo(self, mock_file):
        mock_file = mock_file.return_value
        mock_file.section.return_value = None

        def stub_content():
            return [Repo("x", [("gpgcheck", "original"), ("gpgkey", "some_key")])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_report = update_action.perform()
        written_repo = mock_file.add.call_args[0][0]
        self.assertEquals("original", written_repo["gpgcheck"])
        self.assertEquals("some_key", written_repo["gpgkey"])
        self.assertEquals(1, update_report.updates())
Exemplo n.º 33
0
    def test_update_when_new_repo(self, mock_file):
        mock_file = mock_file.return_value
        mock_file.section.return_value = None

        def stub_content():
            return [Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_report = update_action.perform()
        written_repo = mock_file.add.call_args[0][0]
        self.assertEquals('original', written_repo['gpgcheck'])
        self.assertEquals('some_key', written_repo['gpgkey'])
        self.assertEquals(1, update_report.updates())
Exemplo n.º 34
0
    def test_update_when_new_repo(self, mock_file):
        mock_file = mock_file.return_value
        mock_file.section.return_value = None

        def stub_content():
            return [Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_report = update_action.perform()
        written_repo = mock_file.add.call_args[0][0]
        self.assertEqual('original', written_repo['gpgcheck'])
        self.assertEqual('some_key', written_repo['gpgkey'])
        self.assertEqual(1, update_report.updates())
Exemplo n.º 35
0
    def test_update_when_not_registered_and_existing_repo(self, mock_file):
        self._inject_mock_invalid_consumer()
        mock_file = mock_file.return_value
        mock_file.section.return_value = Repo("x", [("gpgcheck", "original"), ("gpgkey", "some_key")])

        def stub_content():
            return [Repo("x", [("gpgcheck", "new"), ("gpgkey", "new_key"), ("name", "test")])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_action.perform()

        written_repo = mock_file.update.call_args[0][0]
        self.assertEquals("original", written_repo["gpgcheck"])
        self.assertEquals("new_key", written_repo["gpgkey"])
Exemplo n.º 36
0
    def test_update_when_not_registered_and_existing_repo(self, mock_file):
        self._inject_mock_invalid_consumer()
        mock_file = mock_file.return_value
        mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])

        def stub_content():
            return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key'), ('name', 'test')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_action.perform()

        written_repo = mock_file.update.call_args[0][0]
        self.assertEquals('original', written_repo['gpgcheck'])
        self.assertEquals('new_key', written_repo['gpgkey'])
Exemplo n.º 37
0
    def test_update_when_registered_and_existing_repo(self, mock_file):
        mock_file = mock_file.return_value
        mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])

        def stub_content():
            return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_action.override_supported = True
        update_report = update_action.perform()
        written_repo = mock_file.update.call_args[0][0]
        self.assertEquals('new', written_repo['gpgcheck'])
        self.assertEquals('new_key', written_repo['gpgkey'])
        self.assertEquals(1, update_report.updates())
Exemplo n.º 38
0
    def test_update_when_not_registered_and_existing_repo(self, mock_file):
        self._inject_mock_invalid_consumer()
        mock_file = mock_file.return_value
        mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])

        def stub_content():
            return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_action.perform()

        written_repo = mock_file.update.call_args[0][0]
        self.assertEquals('original', written_repo['gpgcheck'])
        self.assertEquals('new_key', written_repo['gpgkey'])
Exemplo n.º 39
0
    def test_update_when_registered_and_existing_repo(self, mock_file):
        mock_file = mock_file.return_value
        mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'),
                                                    ('gpgkey', 'some_key')])

        def stub_content():
            return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_action.override_supported = True
        update_report = update_action.perform()
        written_repo = mock_file.update.call_args[0][0]
        self.assertEquals('new', written_repo['gpgcheck'])
        self.assertEquals('new_key', written_repo['gpgkey'])
        self.assertEquals(1, update_report.updates())
Exemplo n.º 40
0
    def test_update_when_new_repo(self, mock_get_repo_files):
        mock_file = MagicMock()
        mock_file.CONTENT_TYPES = [None]
        mock_file.fix_content = lambda x: x
        mock_file.section.return_value = None
        mock_get_repo_files.return_value = [(mock_file, mock_file)]

        def stub_content():
            return [Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])]

        update_action = RepoUpdateActionCommand()
        update_action.get_unique_content = stub_content
        update_report = update_action.perform()
        written_repo = mock_file.add.call_args[0][0]
        self.assertEqual('original', written_repo['gpgcheck'])
        self.assertEqual('some_key', written_repo['gpgkey'])
        self.assertEqual(1, update_report.updates())
Exemplo n.º 41
0
 def test_overrides_trump_existing(self):
     update_action = RepoUpdateActionCommand()
     update_action.overrides = {'x': {'gpgcheck': 'blah'}}
     values = [('gpgcheck', 'original'), ('gpgkey', 'some_key')]
     old_repo = Repo('x', values)
     new_repo = Repo(old_repo.id, values)
     update_action._set_override_info(new_repo)
     self.assertEqual('original', old_repo['gpgcheck'])
     update_action.update_repo(old_repo, new_repo)
     self.assertEqual('blah', old_repo['gpgcheck'])
     self.assertEqual('some_key', old_repo['gpgkey'])
Exemplo n.º 42
0
 def test_overrides_removed_revert_to_default(self):
     update_action = RepoUpdateActionCommand()
     update_action.written_overrides.overrides = {'x': {'gpgcheck': 'blah'}}
     update_action.overrides = {}
     old_repo = Repo('x', [('gpgcheck', 'blah'), ('gpgkey', 'some_key')])
     new_repo = Repo(old_repo.id, [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
     update_action._set_override_info(new_repo)
     # The value from the current repo file (with the old override) should exist pre-update
     self.assertEqual('blah', old_repo['gpgcheck'])
     update_action.update_repo(old_repo, new_repo)
     # Because the override has been removed, the value is reset to the default
     self.assertEqual('original', old_repo['gpgcheck'])
     self.assertEqual('some_key', old_repo['gpgkey'])
Exemplo n.º 43
0
 def test_overrides_removed_and_edited(self):
     update_action = RepoUpdateActionCommand()
     update_action.written_overrides.overrides = {'x': {'gpgcheck': 'override_value'}}
     update_action.overrides = {}
     old_repo = Repo('x', [('gpgcheck', 'hand_edit'), ('gpgkey', 'some_key')])
     new_repo = Repo(old_repo.id, [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
     update_action._set_override_info(new_repo)
     # The value from the current repo file (with the old hand edit) should exist pre-update
     self.assertEqual('hand_edit', old_repo['gpgcheck'])
     update_action.update_repo(old_repo, new_repo)
     # Because the current value doesn't match the override, we don't modify it
     self.assertEqual('hand_edit', old_repo['gpgcheck'])
     self.assertEqual('some_key', old_repo['gpgkey'])
Exemplo n.º 44
0
 def test_non_default_overrides_added_to_existing(self):
     '''
     Test that overrides for values that aren't found in Repo.PROPERTIES are written
     to existing repos
     '''
     update_action = RepoUpdateActionCommand()
     update_action.written_overrides.overrides = {}
     update_action.overrides = {'x': {'somekey': 'someval'}}
     old_repo = Repo('x', [])
     new_repo = Repo(old_repo.id, [])
     update_action._set_override_info(new_repo)
     update_action.update_repo(old_repo, new_repo)
     self.assertEqual('someval', old_repo['somekey'])
Exemplo n.º 45
0
 def test_non_default_override_removed_deleted(self):
     '''
     Test that overrides for values that aren't found in Repo.PROPERTIES are
     removed from redhat.repo once the override is removed
     '''
     update_action = RepoUpdateActionCommand()
     update_action.written_overrides.overrides = {'x': {'somekey': 'someval'}}
     update_action.overrides = {}
     old_repo = Repo('x', [('somekey', 'someval')])
     new_repo = Repo(old_repo.id, [])
     update_action._set_override_info(new_repo)
     update_action.update_repo(old_repo, new_repo)
     self.assertFalse('somekey' in old_repo)
Exemplo n.º 46
0
 def test_join(self):
     base = "http://foo/bar"
     update_action = RepoUpdateActionCommand()
     # File urls should be preserved
     self.assertEquals("file://this/is/a/file",
                       update_action.join(base, "file://this/is/a/file"))
     # Http locations should be preserved
     self.assertEquals("http://this/is/a/url",
                       update_action.join(base, "http://this/is/a/url"))
     # Blank should remain blank
     self.assertEquals("", update_action.join(base, ""))
     # Url Fragments should work
     self.assertEquals("http://foo/bar/baz",
                       update_action.join(base, "baz"))
     self.assertEquals("http://foo/bar/baz",
                       update_action.join(base, "/baz"))
     base = base + "/"
     self.assertEquals("http://foo/bar/baz",
                       update_action.join(base, "baz"))
     self.assertEquals("http://foo/bar/baz",
                       update_action.join(base, "/baz"))