-
Notifications
You must be signed in to change notification settings - Fork 0
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
added architecture tests + fix bugs + added missing functions #32
Conversation
c4e15dc
to
f4e6223
Compare
tests/integration/test_product.py
Outdated
products = builton.product().search(query=query, json=True) | ||
assert isinstance(products, list) | ||
|
||
for product in products: | ||
print(product['name']) |
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.
please, remove the print
builton_sdk/api_models/user.py
Outdated
class User(Component): | ||
def __init__(self, request, props): | ||
super(User, self).__init__(request, props) | ||
self.api_path = 'users' | ||
|
||
def authenticate(cls, *args, **kwargs): |
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.
could you please add a test for it?
builton_sdk/api_models/tag.py
Outdated
def get_providers(self, url_params=None, json=False): | ||
return self.simple_query(resource='providers', url_params=url_params, json=json, | ||
res_constructor=Provider) | ||
def get_resources(self, url_params=None, json=False): |
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.
could you please add a test for it?
json=json) | ||
body=body, json=json) | ||
|
||
def get_payments(self, url_params=None, json=False): |
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.
could you please add a test for it?
return self.simple_query(_type='put', resource='bulk', body=body, url_params=url_params, | ||
json=json) | ||
|
||
def get_orders(self, body, url_params=None, json=False): |
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.
could you please add a test for it?
@@ -11,3 +12,11 @@ def __init__(self, request, props): | |||
def create_bulk(self, body, url_params=None, json=False): | |||
return self.simple_query(_type='post', resource='bulk', body=body, url_params=url_params, | |||
json=json) | |||
|
|||
def update_bulk(self, body, url_params=None, json=False): |
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.
could you please add a test for it?
return self.simple_query(_id=self.id, resource='sub_products', url_params=url_params, | ||
json=json) | ||
|
||
def search_subproducts(self, query="", url_params=None, json=False): |
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.
could you please add a test for it?
@@ -7,3 +7,11 @@ class Product(Component): | |||
def __init__(self, request, props): | |||
super(Product, self).__init__(request, props) | |||
self.api_path = 'products' | |||
|
|||
def get_subproducts(self, url_params=None, json=False): |
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.
could you please add a test for it?
|
||
|
||
@rest_decorator(create, delete, get, get_all, refresh, update, search) | ||
class Plan(Component): | ||
def __init__(self, request, props): | ||
super(Plan, self).__init__(request, props) | ||
self.api_path = 'plans' | ||
|
||
def get_subscriptions(self, url_params=None, json=False): |
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.
could you please add a test for it?
url_params=url_params, | ||
json=json) | ||
|
||
def confirm(self, body, url_params=None, json=False): |
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.
could you please add a test for it?
@@ -7,3 +7,13 @@ class Payment(Component): | |||
def __init__(self, request, props): | |||
super(Payment, self).__init__(request, props) | |||
self.api_path = 'payments' | |||
|
|||
def pay(self, body, url_params=None, json=False): |
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.
could you please add a test for it?
url_params=url_params, | ||
res_constructor=None | ||
) | ||
def get_payments(self, url_params=None, json=False): |
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.
could you please add a test for it?
@@ -17,6 +17,10 @@ def get_recommendations(self, body, url_params=None): | |||
return self.simple_query(_type='post', _id=_id, resource='invoke', url_params=url_params, | |||
body=body, json=True) | |||
|
|||
def create_version(self, body, url_params=None): |
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.
could you please add a test for it?
actual_functions = get_functions_of(obj) | ||
expected_functions = get_expected_functions_of(obj) | ||
print(actual_functions) | ||
print(expected_functions) |
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.
could you please remove the prints?
if fn not in ignore_functions: | ||
functions.append(fn) | ||
functions.sort() | ||
return functions |
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.
Suggestion/alternative way:
return sorted([f for f in dir(obj) if f not in ignore_functions])
def get_expected_functions_of(obj): | ||
function_name = obj.__name__ | ||
with open('./tests/architecture/architecture.json', 'r') as f: | ||
test = json.load(f) |
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.
Suggestion:
test = json.load(f)[function_name]
would make the following list a bit shorter
@@ -0,0 +1,344 @@ | |||
{ |
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 like the iniciative of having this file! =)
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.
Great job, @NicolasBonduel! Sorry for taking too long to approve it!
No description provided.