Example #1
0
from ocflib.printing.quota import UserQuota
from ocflib.printing.quota import WEEKDAY_QUOTA
from ocflib.printing.quota import WEEKEND_QUOTA

FAKE_DAILY_QUOTA = 1000
FAKE_SEMESTERLY_QUOTA = 10000

TODAY = datetime.today()
YESTERDAY = TODAY - timedelta(days=1)
LAST_SEMESTER = TODAY - timedelta(days=365)

TEST_JOB = Job(
    user='******',
    time=datetime.now(),
    pages=3,
    queue='double',
    printer='pagefault',
    doc_name='asdf',
    filesize=12,
)
TEST_REFUND = Refund(
    user='******',
    time=datetime.now(),
    pages=3,
    staffer='ckuehl',
    reason='just because',
)


@pytest.mark.parametrize(
    'time,expected',
Example #2
0
#!/usr/bin/env python3
"""Add a test job."""
import getpass
import random
import string
from datetime import datetime

from ocflib.printing.printers import PRINTERS
from ocflib.printing.quota import add_job
from ocflib.printing.quota import get_connection
from ocflib.printing.quota import Job

if __name__ == '__main__':
    user = '******'
    password = getpass.getpass('{} password: '******'user: '******'pages: ')),
                queue=random.choice(('single', 'double')),
                printer=random.choice(tuple(PRINTERS)),
                doc_name=''.join(
                    random.choice(string.ascii_letters) for _ in range(30)),
                filesize=random.randint(0, 2**28),
            ),
        )