Skip to content

Instantly share code, notes, and snippets.

@iancrowther
Forked from jayfresh/gist:d4ae552632d9a3a47407
Created May 26, 2015 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iancrowther/ba0474ed7be8f7a945c5 to your computer and use it in GitHub Desktop.
Save iancrowther/ba0474ed7be8f7a945c5 to your computer and use it in GitHub Desktop.

Image service - S3 client acess - 1652 ms should allow access to uploaded files by the app - 1041 ms should not allow web access to uploaded files - 392 ms should not allow an unauthorised user to access the bucket - 218 ms

Image service - upload limit - 972 ms should reject uploads if they are over 2MB - 652 ms should allow uploads if they are under 2MB - 320 ms

#uploadFileForPublicAccess - 341 ms should upload a file to a bucket with public read access - 341 ms

#removePublicFile - 281 ms should delete a file from the public bucket - 281 ms

Public client security policy - 810 ms should allow access to uploaded files by the app - 345 ms should allow web access to uploaded files - 454 ms should not allow an unauthorised user to write to the bucket - 11 ms

Acceptance tests - 15374 ms

Organisations and their properties - 87 ms
    Organisations have access to only their own properties - 87 ms

Creating Tenancies - 71 ms
    Tenancies have a default status of on the market - 37 ms
    Tenancies have their workflow items defaulted to false - 34 ms

Tenancies proceeding to Tenancy Agreement - 667 ms
    Tenancies cannot proceed to AST if tenant ID step not completed - 125 ms
    Tenancies cannot proceed to AST if tenant guarantor not approved nor opted out - 124 ms
    Tenancies can proceed to AST if tenant guarantor is opted out (with all other approvals) - 160 ms
    Tenancies cannot proceed to AST if house is not full and part-full house not approved - 81 ms
    Tenancies can proceed to AST if steps completed and house full - 101 ms
    Tenancies can proceed to AST if steps completed and part-full house approved - 76 ms

Tenancy status setting - 45 ms
    Tenancy status can only be set to one of three values, representing on the market, under offer, or let - 45 ms

Tenancy reset - 200 ms
    Resetting a tenancy should set its status to 'reset' - 98 ms
    Resetting a tenancy should leave all the other fields untouched - 102 ms

Creating a new tenancy from another (used during reset) - 262 ms
    Should create a new tenancy with these properties copied: property, spaces, price, startDate, tenancyAgreementTemplateID - 74 ms
    Should create a new tenancy with no holding payment or security deposit - 98 ms
    Should create a a new tenancy with the status "on the market" - 90 ms

Creating a tenancy agreement - 4645 ms
    should create a tenancy agreement with the shortcodes filled in - 80 ms
    should put a PDF on Amazon S3 with a non-guessable name and publically accessible - 4565 ms

Tenants - 34 ms
    Tenants start with no workflow items completed - 34 ms

Templates - 46 ms
    must be of type 'email' or 'contract' - 46 ms

IPN handling - 327 ms

    on the market tenancies - 126 ms
        should mark the holding payment as paid if the item_name is "Holding Payment" and the payment_status is "Completed" - 57 ms
        should put the paying tenant on the tenancy they are paying the holding payment for - 69 ms

    under offer tenancies - 201 ms
        should mark the holding payment as refunded if the item_name is "Holding Payment" and the payment_status is "Refunded" - 78 ms
        should mark the security deposit as paid for the tenant if the item_name is "Security Deposit" and the payment_status is "Completed" - 58 ms
        should mark the security deposit as refunded for the tenant if the item_name is "Security Deposit" and the payment_status is "Refunded" - 65 ms

Audit Items - 249 ms
    should allow valid types: 'email' or 'note' or 'sms' or 'action' - 33 ms
    should forbid invalid types - 36 ms
    should require a subtype - 45 ms
    should include the target document ID - 35 ms
    should include the target tenant modifying user (if present) - 33 ms
    should include the target tenancy modifying user (if present) - 34 ms
    should be created after every email sent - 33 ms

Audit trail items should be created after model changes - 580 ms
    Tenant pays a holding deposit - 45 ms
    Tenant pays a security deposit - 45 ms
    Tenancy housemates change (storing new housemates) - 47 ms
    Admin approves tenant ID - 43 ms
    Admin approves tenant guarantor - 47 ms
    Tenant adds ID - 46 ms
    Tenant adds guarantor ID - 45 ms
    Tenant opts out of guarantor - 69 ms
    Property manager marks tenancy agreement signed - 54 ms
    Tenancy becomes inclusive or exclusive of utilities - 42 ms
    Tenancy becomes part-full approved - 43 ms
    New tenancy is created - 54 ms

Email notifications and reminders - 8161 ms

    And templating - 8161 ms
        To tenant when their ID is approved - 200 ms
        To tenant when they opt out of having a guarantor - 195 ms
        To all tenants when tenancy is reset - 179 ms
        To all tenants when tenancy AST is marked as signed - 200 ms
        To tenants when added to a tenancy - 700 ms
        To a tenant when holding payment made - 186 ms
        To tenant when security deposit paid - 182 ms
        To tenant when security deposit refunded - 232 ms
        To tenant when holding payment refunded - 206 ms
        To all tenants when property is part-full approved - 716 ms
        Tenant created - 580 ms
        To all PMs when tenant opts out of having a guarantor - 184 ms
        To all PMs (on all organisations) when tenant changes guarantor information - 241 ms
        To all PMs when tenant makes holding payment - 203 ms
        To all PMs when tenancy is ready for AST generation (after tenancy change) - 203 ms
        To all PMs when tenancy is ready for AST generation (after tenant change) - 200 ms
        To all PMs when all tenants on a tenancy have paid their security deposits - 231 ms

        Email reminders - 3322 ms
            Emails tenants without guarantor info or opt-out - 1129 ms
            Emails tenants without approved personal ID - 1099 ms
            Emails lead tenants where property not full and part-full tenancy not approved - 1094 ms

Admin Dash Controller - 14050 ms

access - 1680 ms

    GET /dash - 461 ms
        should not allow unauthenticated requests - 159 ms
        should not allow authenticated requests without a role - 302 ms

    POST /dash/:propertyName - 425 ms
        should not allow unauthenticated requests - 173 ms
        should not authenticated requests without a role - 252 ms

    GET /applicants/:applicantEmail - 375 ms
        should not allow unauthenticated requests - 131 ms
        should not allow authenticated requests without a role - 244 ms

    POST /applicants/:applicantEmail - 419 ms
        should not allow unauthenticated requests - 165 ms
        should not allow authenticated requests without a role - 254 ms

data - 12370 ms

    /dash - 663 ms
        should not error when properties have no location - 662 ms

    #getLocationsPropertyList - 1974 ms
        should create the list of locations available - 503 ms
        should create the list of properties available - 548 ms
        should create each property with address, url and the current application tenancy - 460 ms
        should create each tenancy with a status and a list of tenants with full name - 463 ms

    #getProperty - 6323 ms
        should create a property object with address and beds properties - 527 ms
        should create a property object with an organisation property - 526 ms
        should create a property with a tenancy object, with status, days under offer, a list of tenants (applicants), a list of empty rooms, a flag to say whether it is ready for a tenancy agreement, the tenancy agreement URL and the EchoSign form HTML - 533 ms
        should create the tenants (applicants) list with fullName, email, phone properties, and whether the guarantor is submitted and a guarantor property, and whether the ID is approved - 527 ms
        should create the guarantor with a fullName property - 480 ms
        should create an active_tenancy property with a tenants list - 535 ms
        should create the active tenancy tenants list with each having fullName, email and phone properties - 465 ms
        should create the property with an audit object, with an items array - 473 ms
        should create each item with a type and a date property - 506 ms
        should create each email item with to, from, body and subject properties - 577 ms
        should create the pagination property with previous_page and next_page properties where paging is possible to those pages - 614 ms
        should not throw an error if there are no tenancies on a property - 560 ms

    #getApplicantProfile - 3410 ms
        should create a tenant object with fullName, email, phone, tenancy, data and audit properties - 559 ms
        should create a the tenancy object with a step property and a "property" property, which has address and url properties - 458 ms
        should create a data property with these fields: submitted_housemates, paid_security_deposit, idApproved, opted_out_from_guarantor, guarantor_first_name, guarantor_last_name, guarantor_email, guarantor_phone, guarantor_idApproved, guarantor_approved - 461 ms
        should create the data properties with label and value properties - 497 ms
        should create the tenant with an audit object, with an items array - 465 ms
        should create each item with a type and a date property - 453 ms
        should create the pagination property with previous_page and next_page properties where paging is possible to those pages - 517 ms

App Management Controller - 687 ms

app management - 687 ms

    GET /organisation/properties - 687 ms
        should not throw an error when a property is missing a location - 687 ms

Cron Controller - 13 ms

GET /cronjob - 13 ms
    should allow unauthenticated requests - 13 ms

IP Controller

GET /ipn-handler

Student Dash Controller - 9111 ms

access - 1532 ms

    GET /tenant-dashboard - 396 ms
        should not allow unauthenticated requests - 145 ms
        should not allow authenticated requests without a role - 251 ms

    POST /tenant-dashboard - 385 ms
        should not allow unauthenticated requests - 132 ms
        should not allow authenticated requests without a role - 253 ms

    GET /tenant-dashboard/profile - 375 ms
        should not allow unauthenticated requests - 144 ms
        should not allow authenticated requests without a role - 231 ms

    POST /tenant-dashboard/profile - 376 ms
        should not allow unauthenticated requests - 131 ms
        should not allow authenticated requests without a role - 245 ms

data - 7579 ms

    #getTenancy - 7136 ms
        should create a tenant object with firstName, lastName, email, phone and guarantor properties - 478 ms
        should create the guarantor object with firstName, lastName, email and phone properties - 457 ms
        should create a organisation object with ... properties - 444 ms
        should create a tenancy object with step, is_lead_tenant, inclusiveOfUtilities, utilityBillPayment, holdingPaymentAmount and steps properties - 458 ms
        should correctly identify the lead tenant of a tenancy - 462 ms
        should create the steps array with each items having description and label properties and an optional step_class of "complete" or "current" if the step is complete or current, respectively - 509 ms
        should create the tenancy object with the "under offer" tenancy if a tenant is on more than one tenancy - 518 ms
        should create a security_deposit object with security_deposit_share, first_rent_installment, total, total_inc_bills, message and paid properties - 482 ms
        should create a property object with a rooms array, each item of which is either empty or has a housemate property - 437 ms
        should create the property object with an address field - 451 ms
        should create the housemate objects with firstName, lastName, fullName, email, phone and is_logged_in properties - 464 ms
        should create a housemates property with the appropriate message in it - 455 ms
        should create a guarantor property with the appropriate message in it - 588 ms
        should create a tenant_id property with the appropriate message in it - 469 ms
        should not throw an error if there are no tenancies on a tenant - 464 ms

    #getTenantProfile - 443 ms
        should create a tenant object with firstName, lastName, email and phone properties - 443 ms

Email Service - 1 ms should throw an error if no recipient address is given - 1 ms should throw an error if no documentID given - 0 ms

IPN - 407 ms

IPN#process - 407 ms
    should require "txn_id", "item_number", "payment_status" and "custom" fields to be present - 33 ms
    should return an error if there is no tenant with ID matching the "custom" field - 53 ms
    should return an error if there is no property with address matching the "item_number" field - 56 ms
    should return an error if there is no "on the market" tenancy on the property when the item_name is "Holding Payment" and payment_status = "Completed" - 56 ms
    should return an error if the item_name property is not "Holding Payment" or "Security Deposit" - 44 ms
    should return an error if the payment_status property is not "Completed" or "Refunded" - 45 ms
    should not return an error if tenant ID and property address match an "on the market" tenancy, for both Holding Payments and Security Deposits - 65 ms
    should not return an error for refunds - 55 ms

Organisation - 235 ms

#inviteUser - 59 ms
    should throw an error if no email address is provided - 23 ms
    should send an invite email to the invitee - 36 ms

#generateInviteToken - 28 ms
    returns a string - 28 ms

#addUser - 56 ms
    should throw an error if user does not exist - 23 ms
    should add the user to the organisation - 33 ms

Organisation.redeemInviteCode - 92 ms
    should return an error if the code is invalid - 45 ms
    should not return an error if the code is valid (is stored on an organisation) - 47 ms

PDF Service - 1224 ms

#createPDFFromHTML - 1224 ms
    should create a PDF at the given path from the provided HTML - 1224 ms

Template - 2 ms

#renderTemplate - 2 ms
    replaces shortcodes with fields - 1 ms
    does not throw an error if a shortcode is used that does not appear in the fields - 1 ms

Tenancy - 7321 ms

#addTenant - 112 ms
    should add the tenant to the tenancy - 55 ms
    does not duplicate tenants if they are added multiple times to the same tenancy - 56 ms

#getTenants - 45 ms
    returns the tenants on the tenancy - 45 ms

#clearTenants - 46 ms
    removes all tenants from the tenancy - 46 ms

#removeTenant - 47 ms
    removes a tenant from the tenancy - 47 ms

#approvePartFullHouse - 54 ms
    Approving a part full house sets the appropriate flag on the tenancy - 54 ms

#markHoldingPaymentPaid - 279 ms
    Marking a holding payment paid for a tenant adds a Holding Payment to the Tenancy - 56 ms
    Marking a holding payment paid for a tenancy sets the status of the tenancy to 'under offer' - 55 ms
    Marking a holding payment paid for a tenant without specifying a date returns an error - 56 ms
    Marking a holding payment paid for a tenant without specifying an amount returns an error - 56 ms
    Marking a holding payment paid for a tenancy that already has a holding payment paid returns an error - 56 ms

#markHoldingPaymentRefunded - 305 ms
    Marking a holding payment refunded for a tenancy keeps the Holding Payment on the Tenancy - 65 ms
    Marking a holding payment refunded for a tenancy sets the status of the tenancy to 'on the market' - 66 ms
    Marking a holding payment paid for a tenancy without specifying a tenancy ID returns an error - 46 ms
    Marking a holding payment paid for a tenancy without specifying a tenant ID that has paid a holding payment on that tenancy returns an error - 63 ms
    Marking a holding payment refunded for a tenancy that already has a holding payment refunded returns an error - 64 ms

#markSecurityDepositPaid - 178 ms
    Marking a security deposit paid for a tenant adds a Security Deposit to the Tenancy - 65 ms
    Marking a security deposit paid for a tenant without specifying a date returns an error - 59 ms
    Marking a security deposit paid for a tenant without specifying an amount returns an error - 54 ms

#markSecurityDepositRefunded - 252 ms
    Marking a security deposit refunded for a tenancy keeps the Security Deposit on the Tenancy - 66 ms
    Marking a security deposit paid for a tenancy without specifying a tenancy ID returns an error - 53 ms
    Marking a security deposit paid for a tenancy without specifying a tenant ID that has paid a security deposit on that tenancy returns an error - 66 ms
    Marking a security deposit refunded for a tenant on a tenancy that already has a security deposit refunded for that tenant returns an error - 67 ms

#markTenancyAgreementSigned - 58 ms
    Marking a tenancy agreement as signed sets the appropriate flag on the tenancy - 58 ms

#generateTenancyAgreementHTML - 47 ms
    returns an error if the tenancy if the tenancy does not have a tenancyAgreementTemplateID - 47 ms

#generateTenancyAgreementPdfAndSendToS3 - 4208 ms
    should return an error if the tenancy has no property ID - 55 ms
    should include the property address in the tenancy agreement URL - 1359 ms
    should append a random string to the end of the property address in the URL - 1423 ms
    should generate the HTML for the tenancy agreement - 1371 ms

#createFormForSendingTenancyAgreementToEchoSign - 1556 ms
    should output the form fields needed for EchoSign - 1436 ms
    should throw an error if no callback is provided - 57 ms
    should return an error if the tenancy agreement has not been generated yet - 63 ms

#allSecurityDepositsPaid - 133 ms
    returns true iff there is a paid security deposit for each tenant - 65 ms
    does not count refunded security deposits - 68 ms

Tenant - 310 ms

#approveID - 31 ms
    should set the ID flag to approved - 31 ms

#approveGuarantorID - 33 ms
    should set the guarantor ID flag to approved - 33 ms

#approveGuarantor - 33 ms
    should set the guarantor flag to approved - 33 ms

#optOutGuarantor - 34 ms
    should set the guarantor opt out flag - 34 ms

#getApplicationStep - 179 ms
    should return 1 if the applicant is not part of an under offer tenancy - 44 ms
    should return 2 if the applicant is part of an under offer tenancy - 45 ms
    should return 3 if the applicant group is ready for their tenancy agreement - 43 ms
    should return 4 if the applicant group has signed their tenancy agreement - 47 ms

Finished in 52.818 seconds 193 tests, 433 assertions, 0 failures, 0 skipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment