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

_meta, values(), values_list() #30

Merged
merged 2 commits into from
Jan 5, 2017

Conversation

szykin
Copy link
Contributor

@szykin szykin commented Jan 5, 2017

Happy new year and thanks for your feedback! After reading your comments on PR #26 and PR #27 I decided to change MockModel() function so mocked model will now have _meta attribute. I merged changes from PR #26 and #27 and added some changes so now _meta._forward_fields_map contains kwargs from MockSet() function calls.

P. S. I closed #29 because of messed commit.

@codecov-io
Copy link

codecov-io commented Jan 5, 2017

Current coverage is 100% (diff: 100%)

Merging #30 into master will not change coverage

@@           master   #30   diff @@
===================================
  Files           6     6          
  Lines         350   369    +19   
  Methods         0     0          
  Messages        0     0          
  Branches        0     0          
===================================
+ Hits          350   369    +19   
  Misses          0     0          
  Partials        0     0          

Powered by Codecov. Last update 78d89ca...c8fcac3

@szykin
Copy link
Contributor Author

szykin commented Jan 5, 2017

I think adding _meta property in MockModel() is enough because there are exactly two states of mocked model:

  1. It's a MockModel() return value.
  2. It's created in create() method obj = mock_set.cls(**attrs). In this case it's an instance of django Model class and already has _meta attribute.

@szykin
Copy link
Contributor Author

szykin commented Jan 5, 2017

I reworked _meta and some methods a little so now we get field names just like in django:
f.attname for f in instance._meta.concrete_fields

@stphivos
Copy link
Owner

stphivos commented Jan 5, 2017

Awesome thanks!! 👍

@stphivos stphivos merged commit c060449 into stphivos:master Jan 5, 2017
@szykin szykin deleted the feature/meta_values_list_values branch January 9, 2017 15:16
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

Successfully merging this pull request may close these issues.

3 participants