Esempio n. 1
0
    def test_ls(self):
        # Fails if node doesn't exists.
        self._do('ls {root}', '"{root}" not found in "".')
        self._do('ls {root}/foo', '"{root}" not found in "".')

        # Works if node exists:
        self._do('mkdir -p {root}/foo/bar {root}/foo/baz')
        self._do('ls {root}', 'foo')
        self._do('ls {root}/foo', ['bar', 'baz'])

        # Shows full node JSON info in -l mode:
        self._do('ls -l {root}', expect.Somewhere('"Name": "foo",'))

        # Lists other user's folder
        self._do('ls -u cmac', expect.Somewhere('Photography'))
Esempio n. 2
0
    def test_mkalbum_privacy(self):
        self._do('mkalbum -p {root}/default/album')
        self._do('ls -l {root}/default',
                 expect.Somewhere('"Privacy": "Public",'))

        self._do('mkalbum -p {root}/public/album --privacy=public')
        self._do('ls -l {root}/public',
                 expect.Somewhere('"Privacy": "Public",'))

        self._do('mkalbum -p {root}/unlisted/album --privacy=unlisted')
        self._do('ls -l {root}/unlisted',
                 expect.Somewhere('"Privacy": "Unlisted",'))

        self._do('mkalbum -p {root}/private/album --privacy=private')
        self._do('ls -l {root}/private',
                 expect.Somewhere('"Privacy": "Private",'))
Esempio n. 3
0
    def test_mkdir_privacy(self):
        self._do('mkdir -p {root}/default/folder')
        self._do('ls -l {root}/default',
                 expect.Somewhere('"Privacy": "Public",'))

        self._do('mkdir -p {root}/public/folder --privacy=public')
        self._do('ls -l {root}/public',
                 expect.Somewhere('"Privacy": "Public",'))

        self._do('mkdir -p {root}/unlisted/folder --privacy=unlisted')
        self._do('ls -l {root}/unlisted',
                 expect.Somewhere('"Privacy": "Unlisted",'))

        self._do('mkdir -p {root}/private/folder --privacy=private')
        self._do('ls -l {root}/private',
                 expect.Somewhere('"Privacy": "Private",'))
Esempio n. 4
0
    def test_sync_privacy(self):
        self._stage_files('{root}/default/album', ['{testdata}/SmugCLI_1.jpg'])
        self._do('sync {root}', expect.Somewhere(expect.Reply('yes')))
        self._do('ls -l {root}/default',
                 expect.Somewhere('"Privacy": "Public",'))

        self._stage_files('{root}/public/album', ['{testdata}/SmugCLI_1.jpg'])
        self._do('sync {root} --privacy=public',
                 expect.Somewhere(expect.Reply('yes')))
        self._do('ls -l {root}/public',
                 expect.Somewhere('"Privacy": "Public",'))

        self._stage_files('{root}/unlisted/album',
                          ['{testdata}/SmugCLI_1.jpg'])
        self._do('sync {root} --privacy=unlisted',
                 expect.Somewhere(expect.Reply('yes')))
        self._do('ls -l {root}/unlisted',
                 expect.Somewhere('"Privacy": "Unlisted",'))

        self._stage_files('{root}/private/album', ['{testdata}/SmugCLI_1.jpg'])
        self._do('sync {root} --privacy=private',
                 expect.Somewhere(expect.Reply('yes')))
        self._do('ls -l {root}/private',
                 expect.Somewhere('"Privacy": "Private",'))
Esempio n. 5
0
 def test_get(self):
     self._do('get \\/api\\/v2\\/user',
              expect.Somewhere(['"Code": 200,', '"Message": "Ok",']))