Пример #1
0
def test_get_holiday_by_id():
    my_config = ProgramConfig("Test_Holiday_API",
                              environment="test",
                              loglevel=logging.DEBUG,
                              show_log=True)
    test = Api_Holiday().get_by_id(my_config, 25341)
    assert test.Amount is not None
    assert test.Amount != ''
Пример #2
0
        return None

    print(strQry)

    if strQry is not None:
        cursor.execute(strQry)
        print(cursor.rowcount)
        row = cursor.fetchone()
        while row:
            print(row)
            if row is not None:
                pbg = PlanBalanceGrid(config, row, True)
                result = pbg.send_to_dt()
                if result is not None:
                    pbg.config = None
                    db.recuphours.update_one({'ContactId': pbg.ContactId},
                                             {'$set': pbg.__dict__},
                                             upsert=True)
                    print(result)
            row = cursor.fetchone()
    else:
        print("Sorry, i cannot read your sql file!")
    conn.close()


my_config = ProgramConfig(logfileName="SetRecupJuly",
                          environment="PROD",
                          loglevel=logging.INFO,
                          show_log=True)
load_recup_data_from_sql(my_config)
Пример #3
0
def init_production_config():
    my_config = ProgramConfig("Test_Production_API",
                              environment="test",
                              loglevel=logging.DEBUG,
                              show_log=True)
    return my_config
Пример #4
0
def init_holiday_config():
    my_config = ProgramConfig("Test_Holiday_API",
                              environment="test",
                              loglevel=logging.DEBUG,
                              show_log=True)
    return my_config
Пример #5
0
def test_get_all_persons():
    my_config = ProgramConfig("Test_Person_API",
                              environment="test",
                              loglevel=logging.DEBUG,
                              show_log=True)
    person_list = Api_Person.get_all(my_config)
Пример #6
0
    @cherrypy.expose
    def user(self, person_id):
        p = Person(config=self._config, id=int(person_id))
        if p.get_from_dt():
            self._config.logger.debug("LOGGED:%s" % p.__dict__)
            tmpl = env.get_template('user.html')
            return tmpl.render(user=p)
        else:
            raise cherrypy.HTTPRedirect("/dt_login")


USERS = {'jon': 'secret'}

if __name__ == '__main__':
    my_config = ProgramConfig("Server")
    cherrypy.config.update("server.conf")
    static_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
    cherrypy.config.update({
        'tools.staticdir.dir': static_path,
        'tools.staticdir.on': True
    })
    cherrypy.tree.mount(RootServer(my_config), '/')
    cherrypy.tree.mount(
        DTSecuredServer(my_config), '/secured', {
            '/': {
                'tools.auth_digest.on': True,
                'tools.auth_digest.realm': 'localhost',
                'tools.auth_digest.key': 'a565c27146791cfb',
                'tools.auth_digest.accept_charset': 'UTF-8',
                'tools.auth_digest.get_ha1':
Пример #7
0
import logging

from api_models import *
from models import *
from config import ProgramConfig
'''
my_config = ProgramConfig("GetPerson", environment="test")
my_contact = Contact(my_config, 26083)
my_contact.get_from_dt()
print(my_contact.__dict__)
my_person = Person(my_config, 129)
my_person.get_from_dt()
print(my_person.__dict__)

search_contact = Contact(my_config, 116)
search_contact.get_from_dt()
#search_contact.search_in_dt()
search_contact.download_picture()
print(search_contact)
'''

# TODO: test
my_config = ProgramConfig("CorrectHolidays", "test", logging.DEBUG, True)
api_nominals = Api_Nominal().get_by_resourceid(my_config, 2)
active_nomainal = Api_Nominal().get_active_nominal_for_date(
    api_nominals, '2019-07-23')
Пример #8
0
    conn.search(config.ldap_dsn,
                search_filter=filter,
                search_scope=SUBTREE,
                attributes=[ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES])
    print(len(conn.entries))
    for e in conn.entries:
        print(str(e.uSNChanged))
        print("Changed on: %s" % e.whenChanged)
        print("Created on: %s" % e.whenCreated)
        print("Employee id: %s" % e.employeeID)
        print("Account enabled: %s" % e.userAccountControl)
        try:
            desc = e.description
            logonCount = e.logonCount
            lastLogon = e.lastLogon
            accountExpires = e.accountExpires

        except LDAPCursorError:
            desc = "error"
            logonCount = "?"
            lastLogon = "?"
            accountExpires = "?"
        print(
            format_string.format(str(e.name), str(logonCount),
                                 str(lastLogon)[:19],
                                 str(accountExpires)[:19], desc))


my_config = ProgramConfig("LDAPTests")
test(my_config)
Пример #9
0
    if not dt_util.ask_yes_no_question(
            'Are you sure you want %s as holiday approver for %s?' %
        (new_approver_full_name, contact_to_update_full_name)):
        print("Cancelled")
        return None

    current_email_person_to_update = contact_to_update.Email
    config.logger.info("Current email: %s" % current_email_person_to_update)

    new_email_person_to_update = None
    if current_email_person_to_update is None:
        new_email_person_to_update = input(
            "%s has no email set, thus the flow will not work correctly. Please provide his email:"
        )
    else:
        if config.default_dzjintonik_user_email in current_email_person_to_update:
            new_email_person_to_update = input(
                "This is the default email set... Please change it to: ")

    contact_to_update.Email = new_email_person_to_update
    contact_to_update.HolidayApproverId = new_holiday_approver_id

    if (contact_to_update.send_to_dt()):
        print("Everything done!")
    else:
        print("Something went wrong sending the new contact to DT.")


my_config = ProgramConfig("SetHollidayApprover")
start_update(my_config, 26053, 154)
Пример #10
0
        strQry = None
        try:
            with open(sql_file, 'r') as myfile:
                strQry=myfile.read()
        except Exception as e:
            print("Sorry, I cannot read your SQL file: %s!" %sql_file)
            return None

        cursor.execute(strQry)
        if strQry is not None:

            row = cursor.fetchone()
            while row:
                if row is not None:
                    pms = PayrollModifiedShifts(config, row)
                    if pms.Booking_ID not in modified_shifts:
                        shifts.append(pms)
                    print("TEST %s " %pms)
                row = cursor.fetchone()

                #sys.exit()
        else:
            print("Sorry, i cannot read your sql file!")
        conn.close()
        print("MY SHIFTS: %s" %shifts)
        PayrollModifiedShifts.shifts_to_check = shifts
        return shifts

my_config = ProgramConfig("ShiftsAfterPayroll")
PayrollModifiedShifts.get_modified_shifts_after_payroll(my_config)