コード例 #1
0
class MyTestCase ( unittest.TestCase ):
    def setUp(self):
        self.upl = YaUploader(token)

    def test_create_folder(self):
        self.assertEqual(self.upl.create_folder('test'), 201)

    def test_folder_found(self):
        self.assertEqual(self.upl.folder_info('test'), 'Folder found')

    def test_folder_not_found(self):
        self.assertEqual(self.upl.folder_info('Зasdf'), None)
コード例 #2
0
 def setUp(self):
     self.upl = YaUploader(token)
コード例 #3
0
class TestYaD:
    def setup(self):
        self.token = TOKEN
        self.uploader = YaUploader(self.token)
        self.uploader.mkdir('some_random_dir')

    def teardown(self):
        """подчищаем созданные"""
        self.uploader.del_dir('some_random_dir')
        self.uploader.del_dir('new_shiny_dir')

    def test_get_dir(self):
        """проверка метода проверки папки"""
        code = self.uploader.get_dir('some_random_dir')
        assert rc(code) == 200

    def test_mkdir(self):
        """проверка метода создания папки"""
        code = self.uploader.mkdir('new_shiny_dir')
        assert rc(code) == 201

    def test_get_dir(self):
        """проверка что папка действительно создана"""
        code = self.uploader.get_dir('new_shiny_dir')
        assert rc(code) == 200

    def test_mkdir(self):
        """проверка создания существующей папки"""
        code = self.uploader.mkdir('new_shiny_dir')
        assert rc(code) == 409

    def test_mkdir(self):
        """проверка создания некорректной папки"""
        code = self.uploader.mkdir('')
        assert rc(code) == 400

    def test_mkdir(self):
        """проверка создания папки без авторизации"""
        bad_uploader = YaUploader('bad_token')
        code = bad_uploader.mkdir('bad_dir')
        assert rc(code) == 401
コード例 #4
0
 def test_mkdir(self):
     """проверка создания папки без авторизации"""
     bad_uploader = YaUploader('bad_token')
     code = bad_uploader.mkdir('bad_dir')
     assert rc(code) == 401
コード例 #5
0
 def setup(self):
     self.token = TOKEN
     self.uploader = YaUploader(self.token)
     self.uploader.mkdir('some_random_dir')
コード例 #6
0
def test_create_folder_not_authorized():
    expected_result = 401
    assert YaUploader(ytoken, path).create_folder() == expected_result
    print('Not authorized')
コード例 #7
0
def test_create_folder_ok():
    expected_result = 201
    assert YaUploader(ytoken, path).create_folder() == expected_result
    print('Folder made successfully')
コード例 #8
0
def test_create_folder_ok_path_aleady_exists():
    expected_result = 409
    assert YaUploader(ytoken, path).create_folder() == expected_result
    print('Folder already exists')