Ejemplo n.º 1
0
  def test_inherited_props(self):
    """Test inherited props"""

    trunk_url = self.repos_uri + '/trunk'
    client.propset_remote('svn:global-ignores', '*.q', trunk_url,
                          False, 12, {}, None, self.client_ctx)

    head = core.svn_opt_revision_t()
    head.kind = core.svn_opt_revision_head
    props, iprops, rev = client.propget5('svn:global-ignores', trunk_url,
                                         head, head, core.svn_depth_infinity,
                                         None, self.client_ctx)
    self.assertEquals(props[trunk_url], '*.q\n')

    dir1_url = trunk_url + '/dir1'
    props, iprops, rev = client.propget5('svn:global-ignores', dir1_url,
                                         head, head, core.svn_depth_infinity,
                                         None, self.client_ctx)
    self.assertEquals(iprops[trunk_url], {'svn:global-ignores':'*.q\n'})

    self.proplist_receiver_trunk_calls = 0
    client.proplist4(trunk_url, head, head, core.svn_depth_empty, None, True,
                     self.proplist_receiver_trunk, self.client_ctx)
    self.assertEquals(self.proplist_receiver_trunk_calls, 1)

    self.proplist_receiver_dir1_calls = 0
    self.proplist_receiver_dir1_key = trunk_url
    client.proplist4(dir1_url, head, head, core.svn_depth_empty, None, True,
                     self.proplist_receiver_dir1, self.client_ctx)
    self.assertEquals(self.proplist_receiver_dir1_calls, 1)
Ejemplo n.º 2
0
  def test_inherited_props(self):
    """Test inherited props"""

    trunk_url = self.repos_uri + b'/trunk'
    client.propset_remote(b'svn:global-ignores', b'*.q', trunk_url,
                          False, 12, {}, None, self.client_ctx)

    head = core.svn_opt_revision_t()
    head.kind = core.svn_opt_revision_head
    props, iprops, rev = client.propget5(b'svn:global-ignores', trunk_url,
                                         head, head, core.svn_depth_infinity,
                                         None, self.client_ctx)
    self.assertEqual(props[trunk_url], b'*.q\n')

    dir1_url = trunk_url + b'/dir1'
    props, iprops, rev = client.propget5(b'svn:global-ignores', dir1_url,
                                         head, head, core.svn_depth_infinity,
                                         None, self.client_ctx)
    self.assertEqual(iprops[trunk_url], {b'svn:global-ignores':b'*.q\n'})

    self.proplist_receiver_trunk_calls = 0
    client.proplist4(trunk_url, head, head, core.svn_depth_empty, None, True,
                     self.proplist_receiver_trunk, self.client_ctx)
    self.assertEqual(self.proplist_receiver_trunk_calls, 1)

    self.proplist_receiver_dir1_calls = 0
    self.proplist_receiver_dir1_key = trunk_url
    client.proplist4(dir1_url, head, head, core.svn_depth_empty, None, True,
                     self.proplist_receiver_dir1, self.client_ctx)
    self.assertEqual(self.proplist_receiver_dir1_calls, 1)
Ejemplo n.º 3
0
    def test_propset_local(self):
        """Test svn_client_propset_local.
(also, testing const svn_string_t * input)"""

        head = core.svn_opt_revision_t()
        head.kind = core.svn_opt_revision_head
        unspecified = core.svn_opt_revision_t()
        unspecified.kind = core.svn_opt_revision_working

        path = self.temper.alloc_empty_dir('-propset_local')

        target_path = core.svn_dirent_join(path, b'trunk/README.txt')
        target_prop = b'local_prop_test'
        prop_val1 = b'foo'

        co_rev = client.checkout3(self.repos_uri, path, head, head,
                                  core.svn_depth_infinity, True, True,
                                  self.client_ctx)

        client.propset_local(target_prop, prop_val1, [target_path],
                             core.svn_depth_empty, False, None,
                             self.client_ctx)
        props, iprops, prop_rev = client.propget5(target_prop, target_path,
                                                  unspecified, unspecified,
                                                  core.svn_depth_empty, None,
                                                  self.client_ctx)
        self.assertFalse(iprops)
        self.assertEqual(prop_rev, co_rev)
        self.assertEqual(props, {target_path: prop_val1})

        # Using str(unicode) to specify property value.
        prop_val2 = b'bar'
        client.propset_local(target_prop, prop_val2.decode('utf-8'),
                             [target_path], core.svn_depth_empty, False, None,
                             self.client_ctx)
        props, iprops, prop_rev = client.propget5(target_prop, target_path,
                                                  unspecified, unspecified,
                                                  core.svn_depth_empty, None,
                                                  self.client_ctx)
        self.assertEqual(props, {target_path: prop_val2})

        # Using str(unicode) and check if it uses 'utf-8' codecs on Python 3
        # (or Python 2, only if its default encoding is 'utf-8')
        if utils.IS_PY3 or utils.is_defaultencoding_utf8():
            # prop_val3 = '(checkmark)UNICODE'
            prop_val3_str = (u'\u2705\U0001F1FA\U0001F1F3\U0001F1EE'
                             u'\U0001F1E8\U0001F1F4\U0001F1E9\U0001F1EA')
            client.propset_local(target_prop, prop_val3_str, [target_path],
                                 core.svn_depth_empty, False, None,
                                 self.client_ctx)
            props, iprops, prop_rev = client.propget5(target_prop, target_path,
                                                      unspecified, unspecified,
                                                      core.svn_depth_empty,
                                                      None, self.client_ctx)
            self.assertEqual(props,
                             {target_path: prop_val3_str.encode('utf-8')})