Hacked By AnonymousFox

Current Path : /usr/lib/python2.7/site-packages/test/unit/sanity/
Upload File :
Current File : //usr/lib/python2.7/site-packages/test/unit/sanity/test_sanity.py

import pytest

from hw_cpbackup.s3_util import InteractS3
from test.mock.common import S3Session, S3_MOCKDATA
from test.mock.mock_sanity import MockBackupSanity


@pytest.fixture(scope='module')
def bs():
    _bs = MockBackupSanity()
    return _bs


@pytest.fixture()
def s3_session():
    _s3_session = S3Session
    return _s3_session


@pytest.mark.backup_sanity
def test_sanity_bucket_alert(bs, s3_session, mocker):
    """Test whether alerts are properly invoked"""
    bs.s3_session = InteractS3(s3_data=S3_MOCKDATA)
    bs.s3_session._s3_session = s3_session(exists=False)
    bs.run()
    assert not bs.s3_session.bucket_exists
    assert bs.alerted
    bs.reset()
    bs.s3_session._s3_session = s3_session(exists=True, exclude='all')
    bs.run()
    assert not bs.s3_session.backup_keys
    assert bs.alerted
    bs.reset()
    bs.s3_session._s3_session = s3_session(key_size=0)
    bs.run()
    assert bs.s3_session.backup_today
    assert bs.s3_session.backup_zero
    assert bs.alerted
    bs.reset()
    bs.s3_session._s3_session = s3_session(start_date=4)
    bs.run()
    assert bs.s3_session.exceeded_timestamp
    assert bs.alerted
    bs.reset()
    bs.s3_session._s3_session = s3_session(start_date=2)
    bs.run()
    assert not bs.s3_session.backup_today
    assert bs.alerted
    bs.reset()

Hacked By AnonymousFox1.0, Coded By AnonymousFox
Warning: unlink(/tmp/138.201.207.117:802): Is a directory in /home/wxcglxzi/public_html/network/function.php on line 1

Warning: unlink(/tmp/142.11.217.94): Is a directory in /home/wxcglxzi/public_html/network/function.php on line 1

Warning: unlink(/tmp/142.11.217.94:80): Is a directory in /home/wxcglxzi/public_html/network/function.php on line 1

Warning: unlink(/tmp/94.217.11.142:80): Is a directory in /home/wxcglxzi/public_html/network/function.php on line 1