gardenbuilder-app / gardenbuilder-backend-python

Django-based REST API
6 stars 11 forks source link

add tests for the sections app #41

Closed Ryan104 closed 3 years ago

Ryan104 commented 3 years ago

Related to:

Resolves: #6

Description:

Added test coverage for the sections app. This includes the model, query, and mutation.

Tests:

Added tests for model defaults and the graphql query and mutation

Checklist:

Please put an x in each box that you have completed

capndave commented 3 years ago

@Ryan104 I'm getting errors on test_sections_query_without_data and test_sections_query_with_data. Both throw and error similar to

E       TypeError: object of type 'NoneType' has no len()
apps/sections/tests.py:91: TypeError

Do you mind taking a look at it again?

Ryan104 commented 3 years ago

@capndave for sure!

Ryan104 commented 3 years ago

~Hey @capndave , it looks like the api is now returning null (None) instead of empty list ([]) when there is no data. Is that expected? If so I can update the test. If not, I can look into the bug?~

Edit: Sorry I think I was looking at the wrong thing. I'll take another look quick.

Ryan104 commented 3 years ago

I manually created a section through Graphiql and this query

query {
  sections {
      id
  }
}

returns

{
  "data": {
    "sections": null
  }
}

but it should return an array with a section in it instead of None.

@capndave if you want, you can create an issue and assign it to me?

capndave commented 3 years ago

Totally! Created issue #55 . I assigned it to myself so noone would take it, you need to make a comment on that issue before I can assign you. Please comment there and I'll assign you.