added basic tests for StatsLogs

This commit is contained in:
Sam
2021-01-22 13:58:32 +00:00
parent 1624fe6a82
commit cf5d193765
3 changed files with 60 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
import datetime
from django.utils import timezone
from factory import SubFactory
from factory.fuzzy import FuzzyText, FuzzyInteger, FuzzyDateTime, FuzzyDate, FuzzyDecimal, FuzzyChoice, FuzzyDateTime
from factory.fuzzy import FuzzyText, FuzzyInteger, FuzzyDateTime, FuzzyDate, FuzzyDecimal, FuzzyChoice
from factory.django import DjangoModelFactory
from companies.factories import CompanyFactory

View File

@@ -1,6 +1,9 @@
import random
import string
import json
import datetime
from django.utils import timezone
from rest_framework.test import APITestCase
from rest_framework import status
@@ -99,26 +102,24 @@ class ProductViewSetTest(APITestCase):
"""
# Define request data
data = {
'cif': 'qwerewq',
'company_name': 'qwerewq',
'short_name': 'qwerewq',
'web_link': 'http://qwerewq.com',
'shop': True,
'shop_link': 'http://qwerewq.com',
'platform': 'PRESTASHOP',
'email': 'test@email.com',
'logo': None,
'city': None,
'address': 'qwer qewr 5',
'geo': None,
'phone': '1234',
'mobile': '4321',
'other_phone': '41423',
'description': 'dfgfdgdfg',
'shop_rss_feed': 'http://qwerewq.com',
'sale_terms': 'tewrnmfew f ewfrfew ewewew f',
'shipping_cost': '12.25',
'sync': False
'company': None,
'sku': 'qwerewq',
'name': 'qwerewq',
'description': 'qwerewq',
'image': None,
'url': 'http://qwerewq.com',
'price': '12.21',
'shipping_cost': '21.12',
'shipping_terms': 'qwerewq',
'source': 'SYNCHRONIZED',
'sourcing_date': datetime.datetime.now().isoformat()+'Z',
'update_date': datetime.datetime.now().isoformat()+'Z',
'discount': '0.05',
'stock': 22,
# tags = models.ManyToMany(Tag, null=True, blank=True )
# category = models.ForeignKey(Tag, null=true) # main tag category
# attributes = models.ManyToMany(Tag, null=True, blank=True )
'identifiers': '34rf34f43c43',
}
# Authenticate user
@@ -145,26 +146,24 @@ class ProductViewSetTest(APITestCase):
# Define request data
data = {
'cif': 'qwerewq',
'company_name': 'qwerewq',
'short_name': 'qwerewq',
'web_link': 'http://qwerewq.com',
'shop': True,
'shop_link': 'http://qwerewq.com',
'platform': 'PRESTASHOP',
'email': 'test@email.com',
'logo': None,
'city': None,
'address': 'qwer qewr 5',
'geo': None,
'phone': '1234',
'mobile': '4321',
'other_phone': '41423',
'description': 'dfgfdgdfg',
'shop_rss_feed': 'http://qwerewq.com',
'sale_terms': 'tewrnmfew f ewfrfew ewewew f',
'shipping_cost': '12.25',
'sync': False
'company': None,
'sku': 'qwerewq',
'name': 'qwerewq',
'description': 'qwerewq',
'image': None,
'url': 'http://qwerewq.com',
'price': '12.21',
'shipping_cost': '21.12',
'shipping_terms': 'qwerewq',
'source': 'SYNCHRONIZED',
'sourcing_date': datetime.datetime.now().isoformat()+'Z',
'update_date': datetime.datetime.now().isoformat()+'Z',
'discount': '0.05',
'stock': 22,
# tags = models.ManyToMany(Tag, null=True, blank=True )
# category = models.ForeignKey(Tag, null=true) # main tag category
# attributes = models.ManyToMany(Tag, null=True, blank=True )
'identifiers': '34rf34f43c43',
}
# Authenticate user