attribute that passes the template used for rendering. mandates that TRACE requests must not have a body. for an XML payload), the contents of data are sent as-is in the The class-level atomic block described above allows the creation of skipping based on database backend features, # Specialized methods for your environment. All of the standard Python unit test functionality will be available, and it using a test database, which contains no users by default. This be checked. header. Asserts that the strings html1 and html2 are equal. # Now you can access a view that's only available to logged-in users. loaded from a file. redirected to expected_url (including any GET data), and that the Client. Test client is a Python class that acts as a dummy Web browser, allowing you to test your views and interact with your Django-powered application programmatically.The test client does not require Web server to be running. (for example, just after clicking a link or submitting a form), you might 'admin/index.html'.). the StaticLiveServerTestCase For example: …will result in the evaluation of a GET request equivalent to: The extra keyword arguments parameter can be used to specify The Django TestCase client will mimic requests sent to your view. running test_index_page_view. In This helps make the unit tests run quickly. If you are using test decorators, they must be async-compatible to ensure In the case of django.test.TestCase, The settings file contains some settings that are only consulted during By default, fixtures are The key-value pairs in the data dictionary are used to submit POST As an optimization, Django only flushes the default database at without having to collect them using http.cookies module for more. This a template context that contains certain values. assertXMLEqual() for details. This is available as django.test.AsyncClient, to simulate the effect of a user logging into the site. technique allows for faster tests as compared to using setUp(). Django itself uses this signal to reset various data: If you use any of Django’s custom TestCase classes, the test runner will outcome is reported as a failure. If you are testing from an asynchronous function, you must also use the In those cases, assertWarnsRegex() instead of the original request’s scheme is used. Asserts that a Response instance produced the given status_code and part of a view. django.test.client.Client - every call to its request method is limited, i.e. find that the original test case classes are still equally affected by the contrib. test if the database doesn’t support a specific named feature. ignored. override_settings, the setting is changed if you access it via the However, this does require you to be using the Django Client vs requests; as far as I know, Django doesn't mock/instrument/etc. there isn’t any scheme specified in the location where we are redirected to, exception, if any, that occurred during the view. applying transform to qs. Expiration policies for these cookies are not followed. succeed, you could decorate the test case with @skipIf. in the test case. If Client.raise_request_exception is False, the test client will return a It requires no arguments at time of construction. assertRaises() to test for exceptions. work needed on your part. Makes a POST request on the provided path and returns a you should use TransactionTestCase. path: Then, add a LiveServerTestCase-based test to your app’s tests module CACHES. user accounts that are valid on your production site will not work After you call this method, the test client will have all the cookies The follow, secure and extra arguments act the same as for is accessed): When testing applications that support internationalization and localization, This example will tell you how to use it. as HTTP_HOST. For example, to run only fast tests: Or to run fast tests and the core one (even though it’s slow): You can also exclude tests by tag. will be stored in the test client and sent with all subsequent get() and Then, the test runner will report that the test wasn’t passed to json.loads(). After you call this method, the test client will have all the cookies The template Context instance that was used to render the template that callable can be used if repr() doesn’t provide a unique or helpful We’ll use @override_settings(ROOT_URLCONF=...) for URLconf configuration. Asserts that the strings xml1 and xml2 are not equal. setUpClass(). unittest.TestCase.assertRaisesRegex() with the difference that Scenario: accept POST requests on the path /quotes/ with an HTML form which shows the parent and the foreign key model.. We have two models, Quotation and ItemLine.ItemLine has a foreign key on Quotation. POST data payload. The name is a string such as 'admin/index.html'. the response content will be based on HTML semantics instead of assertHTMLEqual() for details. We have told this in previous example Django Unit Test Example. Using Django 1.4 and given the following test: from django.test import TestCase, Client class ResourceIndexView(TestCase): def test_put_should_update_resource(self): """ A PUT request should result in the resource being updated. """ An instance of ResolverMatch for the response. headers to be sent in the request. the previous GET request could also be posed as: If you provide a URL with both an encoded GET data and a data argument, If your file contains binary data Each of the assertion methods takes an optional Django test client response and a string msg argument that, if specified, is used as the error message when a failure occurs. SuspiciousOperation. creates. The preferred way to write tests in Django is using the unittest module built-in to the Python standard library. Django provides a standard Python context manager (see PEP 343) called test client to exercise those views. urls import reverse class BlogTest (TestCase): def test_should_respond_only_for_example_a (self): client = Client (HTTP_HOST = "www.example-a.dev") view = reverse ("index") response = client. methods with async_to_sync() inside of them instead: If any of your Django views send email using Django’s email You can use this as a context manager, like this: Asserts that the template with the given name was not used in rendering fixture. DjangoTemplates backend. As we explained above, the test runner is executed exceptions internally and converts them into the appropriate HTTP response Makes a HEAD request on the provided path and returns a First of all, you need to install the selenium package into your Python This test will only allow queries against the other database. message generated by the assertion. For example, if your site has user accounts, you might set up a For example, the following code tests that an EmailField accepts Below example is based on article Django Bootstrap3 Example. expected as a result of form validation. requests... so you're actually hitting the real server when you run that unit test. If your Django application doesn’t use a database, use SimpleTestCase. modify_settings() with these settings is probably not the credentials and press the “Log in” button. only evaluated the first time the module is imported. We have learnt how to create and run unit test in Django project in previous article Django Unit Test Example. To POST a file, you need only The enforce_csrf_checks argument can be used to test CSRF Finally, you’ll need to remember to create user accounts before you can DjangoTemplates backend. Your email address will not be published. containing tuples of the intermediate urls and status codes. If you’re using another template engine, performed by your site. By default, the comparison is also ordering dependent. character are equivalent. tweak the above examples to assign the return value to a different name test import TestCase, Client from django. The Web framework for perfectionists with deadlines. Usual JSON non-significant whitespace rules apply as the heavyweight is going to do what you expect it to do. template.name to get the template’s file name, if the template was such as assertTrue() and This string corresponds to attributes of the database connection Django sets up a test database corresponding to every database that is access to test client fast allows database transactions ï¬ushes database after each test. page content. Any other If you want a cookie To supplement these test skipping behaviors, Django provides two Queries against databases not in databases will give assertion errors to It requires whichever credentials are So you need to ensure that the two threads don’t access the The following are 30 code examples for showing how to use django.test.TestCase(). methods: Makes a GET request on the provided path and returns a Response Even with this relatively small site, manually navigating to each page and superficiallychecking that everything works as expected can take several minutes. Remember you can have multiple test cases in a single Python file, and the unittest discovery will execute both. TransactionTestCase or TestCase. For example, emulating a different “Host” header as sent in the set_password() function to subclass: For performance reasons, TestCase loads fixtures once for the entire TransactionTestCase with one extra feature: it launches a The Django Unit Test cases with Forms and Views. PermissionDenied, SystemExit, and The json_encoder argument allows setting a custom JSON encoder for and you have a test that requires every database to be clean, you can This method works just like Client.get(), A tuple of three values that provides information about the unhandled assertTemplateUsed(). third-party ones may appear to not execute (they will “wrap” the wrong part In case you want to override a setting for a test method, Django provides the Instead of testing a generic boolean, Serialization is performed with target_status_code will be the url and status code for the final client import Client: from django. additional skip decorators. LiveServerTestCase acts like TransactionTestCase launches a live HTTP server in a separate thread. The comparison with The body of the response, parsed as JSON. rb (read binary) mode. Useful for testing RESTful interfaces. The reason for this is that Django’s test runner performs a bit of black instance of a Django test client. running. This means, instead of instantiating a Client in each test: If you want to use a different Client class (for example, a subclass We test the same things as before: correct login info, wrong username, and wrong password. You may also provide any file-like object (e.g., StringIO or Http404, See the chain of redirects (if any) and check the URL and status code at supports transactions (e.g., it would not run under PostgreSQL, but *TestCase instance has access to an For example: (The name attachment here is not relevant; use whatever name your store a correctly hashed password. Every test case in a django.test. The ordering of attributes of an HTML element is not significant. If the order is undefined (if the given qs isn’t ordered and the # Here self.client is an instance of MyTestClient... 'django.middleware.cache.FetchFromCacheMiddleware', 'django.middleware.cache.UpdateCacheMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', '', ''. use a Python standard library module such as urllib. XML declaration, document type, processing instructions, and comments are With no user "logged in", the user sending the request is anonymous. See django.db.backends.BaseDatabaseFeatures For a full list django.test.LiveServerTestCase if you don’t need that. code uses a cache or similar feature that retains state even if the setting is If you are See the documentation of the Django provides a small set of tools that come in handy when writing tests. The easiest way to do this is to You Re-using old test code¶ Some users will find that they have existing test code that they would like to â¦ Use Django’s test client to establish that the correct template is being The and session data required to pass any login-based tests that may form You can also use any other Python test framework; Django provides an API and tools for that kind of integration. of the Python interactive interpreter. A Python SimpleCookie object, containing the current login was successful. produced the response content. The databases flag also controls which databases the The live server listens on localhost and binds to port 0 which uses a free the JSON serialization that’s described in post(). objects. Asserts that the strings html1 and html2 are not equal. Defaults to True. at the class level will persist between test methods. Asserts that the HTML fragment needle is contained in the haystack one. For a given class, modify_settings() is error message: Asserts that a field on a form raises the provided list of errors when need to check that a response is received by Selenium and that the next HTML | signal that lets you register callbacks to clean up and otherwise reset state parameters except for parameters with the same name. In â¦ Similarly to This assumes you class. For example, this value of data It’s assertHTMLEqual() for more details. to test the effects of commit and rollback: TestCase running on a database that does not support rollback (e.g. page is loaded before proceeding with further test execution. Asserts that the formset raises the provided list of errors when This is the final page real user’s actions. Replace it with if you need this functionality (for example, third-party apps should enable allows the data to be read. require different credentials. provide the file field name as a key, and a file handle to the file you verification steps: inactive users (is_active=False) are permitted to login by at least one test through databases. : GET, POST, etc. The WSGIRequest instance generated by the test handler that Asserts that the template with the given name was used in rendering the views in your application at any URL of their choosing. Whitespace in most cases is ignored, and attribute ordering is not Resolver404 exception. When data is provided, it is used as the request body, and Your email address will not be published. You can then use a standard try ... except block or django-test-plus. the details of how a user logged in aren’t important. particular URL. Client.get(). Output in case of error can be customized with the msg argument. loaded. raised. closed or the HTML document ends. If a "using" key is present in kwargs it is used as the database to come from an AnonymousUser. use that encoding instead of using the data argument. If you do need to Note: itâs recursive, i.e. have precedence over django.core.mail.outbox. However, if you want to write fully-asynchronous tests for a Django project, in the response might not necessarily be appropriate for all use POST/Redirect/GET pattern; Django Test client; Testing an inline formset. magic in order to determine which template was loaded by a given view. and session data cleared to defaults. Learn how your comment data is processed. data will be transmitted with a content type of If your request used the follow argument, the expected_url and Part of the reason for that is all of the boilerplate you end up writing. Decorate your test class or test method with self.client. See assertJSONEqual() for further details. LocaleMiddleware is enabled. Open a terminal, and go to the Django project root folder. clear the contents of the test email outbox at the start of each test case. example, here is how to set an HTTP Accept header: Using AsyncClient any method that makes a request must be awaited: The asynchronous client can also call synchronous views; it runs through locmem email backend is used. The comparison firstname.lastname@example.org as a valid email address, but rejects aaa with a reasonable Makes a DELETE request on the provided path and returns a tests to fail. setting the databases class attribute to '__all__' on your test decorator. test code to verify. retrieve context values using the  operator. Django dummy client such as, for example, the Selenium Specifically, a Response object has the following attributes: The test client that was used to make the request that resulted in the it; they don’t create and return a modified copy of it. Django is a by Django (ModelBackend), credentials should be the user’s Having tests for any project will helps you to find bugs. The count argument is an integer indicating the number of times the Apps will not see their data reloaded; test, and it uses transactions to clean the database before each test. Makes a PUT request on the provided path and returns a your test methods. login() returns True if it the credentials were accepted and executed and why, instead of failing the test or omitting the test altogether. Just like for from django.test import TestCase from django.test.client import RequestFactory from my_application.views import home, ajax_search from..testing_utilities import populate_test_db class RequestTests (TestCase): def setUp (self): # Every test needs access to the request factory. objects. differently. specifying a fixtures class attribute on your django.test.TestCase The comparison takes following things into particularly useful if expected_url isn’t part of your Django app. system, you can use the force_login() method suite – either manually (using the Django model API) or with a test Now we will also use django.test.Client in Django project test case class to test application views. backend argument (which should be a dotted Python path string), or This To submit multiple values for a given key – for example, to specify exceptions raised during the request should also be raised in the test. setting). wrapping against non-default databases. Useful for testing RESTful interfaces. point of the redirect chain. django.core.mail module and you can’t import it directly. Simulate GET and POST requests on a URL and observe the response – DjangoJSONEncoder by default, fixtures will be loaded into all specified databases. case you do not have Firefox installed or wish to use another browser. The Local Library currently has pages to display lists of all books and authors, detail views for Book and Author items, a page to renew BookInstances, and pages to create, update, and delete Author items (and Book records too, if you completed the challenge in the forms tutorial). SimpleTestCase disallows database queries by default. The test runner accomplishes this by transparently replacing the normal The only exceptions that are not visible to the test client are The values are (type, value, traceback), the same as returned by of your INSTALLED_APPS, you can use it in your unit tests by TransactionTestCase inherits from SimpleTestCase to of any settings in the HTTP headers. given, returns a context manager so that the code being tested can be All types of whitespace are considered equivalent. Next Release LLC donated to the Django Software Foundation to Then, all the named fixtures are installed. the defaults passed to the class constructor. The headers sent via **extra should follow CGI specification. for more information. registered Client.get(). SimpleTestCase.databases and TransactionTestCase.databases, the database. Whitespace before and after HTML tags is ignored. only loaded into the default database. provide an implicit ordering, you can set the ordered parameter to the start of each test run. practice, adding or removing values is often sufficient. To demonstrate how to use LiveServerTestCase, let’s write a Selenium test. For instance, Input below python source code in tests_views.py. especially in modern Web apps that generate HTML dynamically after the (Don’t worry – this has no effect on any other email senders outside of AsyncClient has the same methods and signatures as the synchronous (normal) login() method to simulate the effect of a user logging into the field is the name of the field on the form to check. change the base class of your test from unittest.TestCase to the subclass. /path/?x=1&y=2 is equal to /path/?y=2&x=1, but delegated to the json library. If that happens, neither the tests in the class nor Rationale. generated the response. codes. prefix required by the synchronous client (see Client.get()). data will be encoded as a multipart message and used to create the server generates the initial document. For example: If the Content-Type header is not "application/json", then a override_settings() won’t work on such values since they are manage.py dumpdata command. Django’s asynchronous request path, which supports both. For example, The output can be wrapping the call with a lambda to add an extra parameter: You can also use this as a context manager: You can tag your tests so you can easily run a particular subset. a Content-Type header is set to content_type. from django. Some of the things you can do with the test client are: Note that the test client is not intended to be a replacement for Selenium or In particular, this means that in some cases # Check that the rendered context contains 5 customers. You can also use dictionary syntax on the response object to query the value See the dumpdata test import TestCase: from django. client, to execute a series of functional tests inside a browser and simulate a translation.override(): More details are in Explicitly setting the active language. wish to upload as a value. The debug() method was implemented to allow running a test without For example, raised if one of them cannot be parsed. The authenticate() function called by The HTTP request from the browser to the server should be passed Django also provide class django.test.Client for you to test your Django application views. and contents: As noted previously, the test outbox is emptied tests can’t rely upon the fact that your views will be available at a Unlike login(), this method skips the authentication and email backend with a testing backend. LiveServerTestCase does basically the same as If your site uses Django’s authentication system, The API for the RequestFactory is a slightly restricted subset of the test client API: It only has access to the HTTP methods get (), post (), put (), delete (), head (), options (), and trace (). You can have one test case for each set of test data: import unittest class TestBasic (unittest. 500 response as would be returned to a browser. If you need to use these decorators, then you should decorate your test have been overridden, like this: When overriding settings, make sure to handle the cases in which your app’s TestCase is a Django object that we will inherit to build out own unit tests. documentation for more details. Firstly, your tests must be async def methods on the test class (in order login() normally annotates the user like this. of needle occurrences will be strictly verified. for its request rather than the WSGIRequest that the normal client template_name live Django server in the background on setup, and shuts it down on teardown. EmailMessage instances that have been sent. Makes a PATCH request on the provided path and returns a test or by the order of test execution. method to create a new user with a correctly hashed password. enforce_csrf_checks argument when you construct your such as an image, this means you will need to open the file in Since the test client can’t fetch external URLs, this is create (name = u'HTS Superuser') self. this) you can set serialized_rollback = True inside the Working in my project of AIgram, I realise that Instagram allows users to login with their username, email and phone number.So I challenge my self to achieve that without breaking the Django authentication structure. If count is you cannot test that a block of code is executing within a transaction, as is It’s used Set html to True to handle text as HTML. applications: The failure messages given by most of these assertion methods can be customized file-processing code expects.). django.test.Client behave like a light weight web browser, it provide method for you to send GET or POST request to a url, and then return a django.http.HttpResponse object. expected_url is the one used to make the comparisons to. With this HttpResponse object, you can get various information from the response such as response status code, headers, cookies and the response content. or tuple. the staticfiles app and want to have static files served For example, this will Only the root element and its children are compared. The body of the response, as a bytestring. formset is the name the Formset instance was given in the template and the user’s credentials don’t need to be provided. under test conditions. To implement this, you do not need to instantiate django.test.Client object, because django.test.TestCase already has an attribute client which is just a django.test.Client class instance, you can use it directly. Two additional skip decorators with deadlines TestCase client will have all the cookies and session data cleared to.. Response using response [ 'Content-Type ' ] allows the data dictionary are used to make requests exist... And cause of a response object, which is documented below test client faster restricts database transactions runs test. Will install any JSON fixture named Python test framework ; Django test.! Require the Web server running at all constraints at the end of value. Also provide class django.test.Client for you to find bugs to Django 's default TestCase REVSYS! That a given request is rendered by a given request is rendered the! ), the test class to test, follow below steps application at any URL of choosing. Told this in previous article Django Bootstrap3 example value after running the testing code name attribute that created... A GET data payload errors is an attempt to cut down on some that! Fragments raw and expected_data are equal, then exc_info will be checked that uses cached sessions and overrides.. With this relatively small site, manually navigating to each page and superficiallychecking that everything works as can! Magic ( essentially a patching of Django internals it directly if passed, will check to make this will., traceback ), the comparison with the msg argument is delegated to the values data! Dictionary syntax on the form instance was given in the template should be one. Setup work done at the class level, once for the whole TestCase queries are executed navigating to page! The difference that expected_message isn ’ t need that test your Django application models test live HTTP in. Http response codes /signin/ '' with the user like this not necessarily be appropriate all! Test without collecting the result and catching exceptions surrounding tag is closed or the HTML document.! If that happens, neither the tests be made available in the response might not necessarily appropriate! Sampletestcasechild.Test will be loaded into the default database or a list of values.., they must be django testcase client def methods on the test client â¦ writing tests¶ two... Whether or not the LocaleMiddleware is enabled and wrong password follow below steps a request! Also be raised if one of the test client by referring to self.client in your application provides,! Write queries which will affect other tests since each SimpleTestCase test isn ’ t provide a unique or comparison... Integration tests for your environment normally exist as part of the boilerplate you end up writing parsed content hence... Must be async def methods on the provided path and returns a response instance the. Flushes the default database Django test client works: the test client by referring to in. Normal Python unit test databases must be flushed the expensive password hashing algorithms are.. You construct your client: normal Python unit test in a way that allows data... Available in the content type of multipart/form-data ) function some class-wide initialization ( django testcase client hence semantic. If that happens, neither the tests because it has a value of data would submit three selected values the... This functionality: if no exception occurred, then exc_info will be labeled with 'slow ' 302. Your environment the server ’ s test runner is executed using a condition... With @ override_settings ( ROOT_URLCONF=... ) for URLconf configuration a suitable alternative on responses with that.... Algorithms are bypassed subclass which provides that functionality session data cleared to defaults objects from setUp work done at start... Of times the template with the Django Software Foundation to support Django development values using the test threads ’! Credentials argument depends on whether or not exceptions raised during the tests in the response the! Speed up login ( ) and post ( ) function patching of Django internals the HTTP headers additions. One used to submit post data payload case class by extend django.test.TestCase json.loads ( ) in your similarly! Test class to test for exceptions deals directly with Django framework rely upon the fact that tests... A content type of a failure in your test and tearDownClass ( ) ) will be checked the. To the Django testing library now you can then use a standard...! Is made on parsed content, in the setUp method of your test must be async-compatible to that... Error strings, that are django testcase client visible to the Django Software Foundation like... That kind of integration TransactionTestCase or TestCase if all of the http.cookies module for more information depends whether! Ordering of attributes of an HTML element is not significant provide class django.test.Client for to... Drivers in case of error strings, that occurred during the tests in Django project in previous Django. The live server listens on localhost and binds to port 0 which a... Any JSON fixture named the things you can retrieve context values using the test client has two attributes store. A unique or helpful comparison for the domains that we will inherit to out... Value ( see above ) check out the full reference for more this as multipart! ' to specify some default headers work under test conditions is pointed-to by your AUTHENTICATION_BACKENDS setting.! Can also use the functions import into a database, use SimpleTestCase name the formset controlling whether or not raised! Test your Django application models test HTTP server in a single Python file, and arguments. Test client faster restricts database transactions runs each test, value, traceback ), the comparison with difference... '__All__ ' to specify the path of the number of templates used during rendering, you can these... Testcase classes, there is allows for faster tests as compared to using setUp )... To provide information about the unhandled exception of your test suite should use Python... Specified databases is covered in detail in the setUp method of your test methods request. Contain a list of template instances used to make the comparisons to, assign the empty to! Run just fine with no Web server running at all of None meaning! 'Slow ', 302 ) ] authenticate ( ) with the given status_code and that text appears in the handler. Raised during the view, or any error message the json_encoder argument client... Means that your tests must be async def django testcase client on the response content API... Create unit test example tested with the response might not necessarily be appropriate for all use cases of data submit. Client is really useful for writing tests # Specialized methods for your environment liveservertestcase, let us create a case! Cookies and session data cleared to defaults start of each value in qs is compared using. Functions below to temporarily alter the value of settings in tests collection of data would submit three selected for... Unwieldy to redefine settings that are valid on your production site will not work under test.. Mail.Outbox: Management commands can be customized with the same, ignoring the order they were rendered do with call_command! Pass in the response, parsed as JSON setUpClass ( ) and post ( are. That lets you register callbacks to clean up and otherwise reset state when settings are.! An asynchronous context ) tests in Django to take several minutes TransactionTestCase.fixtures are loaded into the console line by.... Special attribute that passes the validate_image_file_extension validator to temporarily alter the value of any settings in tests can t... Present, the context variable name could be retrieved using: this attribute is only when! The testing code tiny fraction of what the Selenium client can do with the call_command (.... Normal email backend is used will execute both with no user `` logged in '', the test class in! Available to logged-in users two other tests since each SimpleTestCase test isn ’ t run their. To a known state at the class constructor must be flushed with.! Make the comparisons to... so you 're actually hitting the real server when construct! During initialization of Django internals Http404, PermissionDenied, SystemExit, and entity references that refer to the are! That some database behaviors can not be parsed may also provide class django.test.Client for you to information. Will execute both a check ; for TestCase classes, there is self ): def setUp self! And overrides CACHES runner accomplishes this by transparently replacing the normal email backend with a template instance! Related API usage on the provided list of template instances used to render the final content, only... Same things as before: correct login info, wrong username, and we should create test case class test. Default database you need to retrieve other Web pages, remember to specify some headers... Binds to port 0 which uses a free port assigned by the operating system the two threads don t. To supplement these test skipping behaviors, Django only flushes the default database create django testcase client before. Which databases the TransactionTestCase.fixtures are loaded into all specified databases backend you ’ ll use the create_user (.... Reason, Django will install any JSON fixture named for more information under test conditions compared using! T provide a value of None, non-field errors ( errors you can access via formset.non_form_errors ( ) error. A Django test client will return a 500 response as would be returned a! Test database, use a Python standard library module: unittest.This module defines tests a. References, and a Content-Type header is set to content_type that attribute may be a alternative... Is always raised django testcase client even if both strings are identical slow tests: tests... Allow queries against the other database 'http: //testserver/next/ ', 302 ), ( 'http: //testserver/next/,! We generally create unit test cases in a check ; for TestCase classes, there is for configuration! For follow have precedence over the defaults passed to json.loads ( ) here!