Skip to content

[Feature] Solution for Valid Order in Issue 1 should be more consistent in its behaviour  #12

@TomHanra

Description

@TomHanra

Is your feature request related to a problem? Please describe.
The validOrder function given in code.py returns a string in the event of success and a string in the event of an error but the successful solution needed is one that actually ignores an invalid amount or quantity rather than return an error string when encountering it because of the specific output hack.py is looking for. solution.py returns a error string in other cases, just not there.

Describe the solution you'd like

  • hack.py could be testing using assetNotEqual to check that the attempt to purchase the items fraudulently simply did not succeed in some way
  • Unrelated to this but hack.py should be attempting to exploit both the amount and quantity properties

Describe alternatives you've considered
Other options include:

  • pydoc for validOrder indicating the response strings expected in different scenarios ("An unexpected error occurred" for an error case, for example)
  • hack.py could expect the same error string as returned in line 28 (though that message will need tweaking, again "An unexpected error occurred" or "something went wrong" could work)
  • validOrder could be a function that calculates the balance given the items and raises an exception when an invalid state is reached, that way hack.py could check for an exception being thrown and the output is more regular

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions