Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autograder test case replacing int with Enum (api.OperationCode) in Encoding #1

Open
bkettle opened this issue Sep 22, 2021 · 0 comments

Comments

@bkettle
Copy link

bkettle commented Sep 22, 2021

Hello,

Unless I'm missing something, I believe this is unintended behavior:

Line 1071 of ag1_runner.py is as follows:

            server._storage.userbase[username] = replace_int(udata, 5, api.OperationCode.PUT_PHOTO, api.OperationCode.REGISTER)

This code does not function as I believe it is intended: instead of replacing the integer value of PUT_PHOTO with the integer value of REGISTER, it replaces the integer value of PUT_PHOTO with the Enum object REGISTER. This results in the decode_log_entry receiving values it items that are neither ints nor bytes types, which would not happen in a real client/server relationship.

To fix this, I think that line 1071 should be replaced with

            server._storage.userbase[username] = replace_int(udata, 5, api.OperationCode.PUT_PHOTO.value, api.OperationCode.REGISTER.value)

This will strictly replace an integer with an integer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant