-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add new tests for models #610
Conversation
Code Climate has analyzed commit e0c305b and detected 6 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
end | ||
filenames | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed this method since it is not being used anywhere else.
Here is the relevent commit aadd8b5
I couldn't find public_filenames
being called in the current code.
|
||
def validate | ||
self.name != 'untitled' | ||
self.lat >= -90 && self.lat <= 90 && self.lon >= -180 && self.lat <= 180 | ||
end | ||
|
||
# Hash the password before saving the record | ||
#Hash the password before saving the record | ||
def before_create | ||
self.password = Password::update(self.password) if self.password != "" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is supposed to Hash the password but before_create
is never called????
Map passwords are stored in plain text???
Is this okay???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Password needs to be encrypted with one way hash functions. This should be problem as per theory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren Map passwords are not being hashed. They're stored in plain text.
Security concern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite an old feature, but the problem is that we may have existing maps that use it. Can we confirm that there is no way to /make/ a new passworded map?
app/models/way.rb
Outdated
def bbox=(bbox) | ||
# counting from left, counter-clockwise | ||
self.lon1,self.lat2,self.lon2,self.lat1 = bbox | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is redundant too.
What is the Way model supposed to do anyway?
It is not being used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be used in annotations, but am not sure! Can you look at the annotations interface which may be a bit broken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we could address this in another issue later. You could also look at the commits around that time using the history or blame view - see? Yes, this is VERY old! And, i think, can go!
Codecov Report
@@ Coverage Diff @@
## main #610 +/- ##
=========================================
+ Coverage 41.1% 41.36% +0.25%
=========================================
Files 34 34
Lines 1321 1308 -13
=========================================
- Hits 543 541 -2
+ Misses 778 767 -11
|
@jywarren @sashadev-sky @SidharthBansal @cesswairimu @alaxalves |
|
||
def validate | ||
self.name != 'untitled' | ||
self.lat >= -90 && self.lat <= 90 && self.lon >= -180 && self.lat <= 180 | ||
end | ||
|
||
# Hash the password before saving the record | ||
#Hash the password before saving the record | ||
def before_create | ||
self.password = Password::update(self.password) if self.password != "" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Password needs to be encrypted with one way hash functions. This should be problem as per theory
Awesome! |
Yes, I think so. But gosh this is old. Do we even allow people to make
passworded maps anymore?
…On Tue, May 21, 2019 at 3:05 AM Kaustubh Nair ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/models/map.rb
<#610 (comment)>:
>
def validate
self.name != 'untitled'
self.lat >= -90 && self.lat <= 90 && self.lon >= -180 && self.lat <= 180
end
- # Hash the password before saving the record
+ #Hash the password before saving the record
def before_create
self.password = Password::update(self.password) if self.password != ""
end
@jywarren <https://github.com/jywarren> Map passwords are not being
hashed. They're stored in plain text.
Security concern?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#610?email_source=notifications&email_token=AAAF6J2Q2U5NY3JAZQS3JPTPWONKPA5CNFSM4HNF6WY2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZF64KI#discussion_r285876974>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAF6JYGAL4MJDHLDVFK4RLPWONKPANCNFSM4HNF6WYQ>
.
|
Oh yeah, I did not notice that. |
Also, @publiclab/mapknitter-reviewers @jywarren this is ready for merge! |
.rubocop.yml
Outdated
@@ -0,0 +1,2 @@ | |||
Metrics/BlockLength: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/unit/annotation_test.rb
Outdated
@@ -17,6 +17,16 @@ def setup | |||
end | |||
|
|||
test 'geometry type' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I wait for these last couple things before merging? Thanks!!!!
BTW @kaustubh-nair I could work on this one and you could work on #615. What do you think? There are only small patches left for both. Let's get those merged today 💪 💪 💪 💪 |
@alaxalves Awesome go ahead |
Done! @jywarren This is ready to merge |
75fa2f1
to
2507f16
Compare
Hi! I believe this just needs a rebase - thank you!!!! |
Perfect, thank you!!!! |
* Add annotation tests and remove redundant code * Add export tests * Remove some code * Fix codeclimate issues * Fix codeclimate issues * Fix rubocop block length * Removing rubocop cfg since publiclab#547 and renaming tests
Part of #594
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!