synopsis = "MAGIC_ALIAS: [NICKNAME LOCALDIR]"
def parseArgs(self, alias, nickname=None, localdir=None):
BasedirOptions.parseArgs(self)
- self.alias = alias
+ if not alias.endswith(':'):
+ raise usage.UsageError("An alias must end with a ':' character.")
+ self.alias = alias[:-1]
self.nickname = nickname
self.localdir = localdir
if self.nickname and not self.localdir:
stdin = StringIO("")
def parseArgs(self, alias, nickname=None):
BasedirOptions.parseArgs(self)
- self.alias = alias
+ if not alias.endswith(':'):
+ raise usage.UsageError("An alias must end with a ':' character.")
+ self.alias = alias[:-1]
self.nickname = nickname
node_url_file = os.path.join(self['node-directory'], "node.url")
self['node-url'] = open(node_url_file, "r").read().strip()
from allmydata.scripts import magic_folder_cli
from allmydata.util.fileutil import abspath_expanduser_unicode
from allmydata.frontends.magic_folder import MagicFolder
-
+from allmydata import uri
class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
def create_magic_folder(self, client_num):
- d = self.do_cli("magic-folder", "create", "magic", client_num=client_num)
+ d = self.do_cli("magic-folder", "create", "magic:", client_num=client_num)
def _done((rc,stdout,stderr)):
self.failUnless(rc == 0)
self.failUnless("Alias 'magic' created" in stdout)
return d
def invite(self, client_num, nickname):
- d = self.do_cli("magic-folder", "invite", u"magic", nickname, client_num=client_num)
+ d = self.do_cli("magic-folder", "invite", u"magic:", nickname, client_num=client_num)
def _done((rc,stdout,stderr)):
self.failUnless(rc == 0)
return (rc,stdout,stderr)
d.addCallback(_done)
return d
- def diminish_readonly(self, write_cap):
- d = self.do_cli("ls", "--json", write_cap)
- def get_readonly_cap((rc,stdout,stderr)):
- self.failUnless(rc == 0)
- readonly_cap = json.loads(stdout)[1][u"ro_uri"]
- return readonly_cap
- d.addCallback(get_readonly_cap)
- return d
-
def check_joined_config(self, client_num, upload_dircap):
"""Tests that our collective directory has the readonly cap of
our upload directory.
return (rc,stdout,stderr)
d.addCallback(_done)
def test_joined_magic_folder((rc,stdout,stderr)):
- d2 = self.diminish_readonly(upload_dircap)
- def fail_unless_dmd_readonly_exists(readonly_cap):
- s = re.search(readonly_cap, stdout)
- self.failUnless(s is not None)
- d2.addCallback(fail_unless_dmd_readonly_exists)
- return d2
+ readonly_cap = unicode(uri.from_string(upload_dircap).get_readonly().to_string(), 'utf-8')
+ s = re.search(readonly_cap, stdout)
+ self.failUnless(s is not None)
+ return None
d.addCallback(test_joined_magic_folder)
return d
self.failIf(ret is None)
def create_invite_join_magic_folder(self, nickname, local_dir):
- d = self.do_cli("magic-folder", "create", u"magic", nickname, local_dir)
+ d = self.do_cli("magic-folder", "create", u"magic:", nickname, local_dir)
def _done((rc,stdout,stderr)):
self.failUnless(rc == 0)
return (rc,stdout,stderr)
self.basedir = "cli/MagicFolder/create-invite-join"
self.set_up_grid()
self.local_dir = os.path.join(self.basedir, "magic")
- d = self.do_cli("magic-folder", "create", u"magic", u"Alice", self.local_dir)
+ d = self.do_cli("magic-folder", "create", u"magic:", u"Alice", self.local_dir)
def _done((rc,stdout,stderr)):
self.failUnless(rc == 0)
return (rc,stdout,stderr)