Exemplo n.º 1
0
 def test_fields(self):
     node_settings = DropboxNodeSettings(user_settings=self.user_settings)
     node_settings.save()
     assert_true(node_settings.user_settings)
     assert_equal(node_settings.user_settings.owner, self.user)
     assert_true(hasattr(node_settings, 'folder'))
     assert_true(hasattr(node_settings, 'registration_data'))
Exemplo n.º 2
0
 def test_fields(self):
     node_settings = DropboxNodeSettings(user_settings=self.user_settings)
     node_settings.save()
     assert_true(node_settings.user_settings)
     assert_equal(node_settings.user_settings.owner, self.user)
     assert_true(hasattr(node_settings, 'folder'))
     assert_true(hasattr(node_settings, 'registration_data'))
 def test_migrate(self):
     migration.migrate(dry_run=False)
     assert_equal(
         DropboxUserSettings.find().count(),
         6
     )
     assert_equal(
         DropboxNodeSettings.find().count(),
         3
     )
     for user_settings in DropboxUserSettings.find():
         assert_is_not_none(user_settings.owner)
         assert_false(hasattr(user_settings, 'access_token'))
     for node_settings in DropboxNodeSettings.find():
         assert_is_not_none(node_settings.owner)
         if (
                 not node_settings.user_settings or
                 not node_settings.external_account
         ):
             assert_in(
                 node_settings.folder,
                 map(
                     lambda d: d['folder'],
                     self.unauthorized_node_settings_documents
                 )
             )
Exemplo n.º 4
0
    def test_has_auth(self):
        settings = DropboxNodeSettings(user_settings=self.user_settings)
        settings.save()
        assert_false(settings.has_auth)

        settings.user_settings.access_token = '123abc'
        settings.user_settings.save()
        assert_true(settings.has_auth)
Exemplo n.º 5
0
    def test_has_auth(self):
        settings = DropboxNodeSettings(user_settings=self.user_settings)
        settings.save()
        assert_false(settings.has_auth)

        settings.user_settings.access_token = '123abc'
        settings.user_settings.save()
        assert_true(settings.has_auth)
Exemplo n.º 6
0
 def test_migrate(self):
     migration.migrate(dry_run=False)
     assert_equal(DropboxUserSettings.find().count(), 6)
     assert_equal(DropboxNodeSettings.find().count(), 3)
     for user_settings in DropboxUserSettings.find():
         assert_is_not_none(user_settings.owner)
         assert_false(hasattr(user_settings, 'access_token'))
     for node_settings in DropboxNodeSettings.find():
         assert_is_not_none(node_settings.owner)
         if (not node_settings.user_settings
                 or not node_settings.external_account):
             assert_in(
                 node_settings.folder,
                 map(lambda d: d['folder'],
                     self.unauthorized_node_settings_documents))
Exemplo n.º 7
0
 def test_folder_defaults_to_none(self):
     node_settings = DropboxNodeSettings(user_settings=self.user_settings)
     node_settings.save()
     assert_is_none(node_settings.folder)
Exemplo n.º 8
0
 def test_folder_defaults_to_none(self):
     node_settings = DropboxNodeSettings(user_settings=self.user_settings)
     node_settings.save()
     assert_is_none(node_settings.folder)