Exemple #1
0
    def setUp(self):
        """ create the user and get the token """
        url = '/api/users/'
        data = {
            "first_name": "sazid",
            "email": "*****@*****.**",
            "password": "******",
            "user_type": 2,
            "status": 1}
        response = self.client.post(url, data, format='json')
        self.user_token = getToken(response.data["data"]["id"])
        """ End """

        """ create the business card with notes"""

        self.business_card_data = {
            "business_notes": {
                "note_frontend": "side first",
                "note_backend": "side second"
            },
            "bcard_json_data":
                '{"side_first": {"basic_info": [{"value": "MyBusinesscar", "isUpper": "1", \
                "keyName": "CardName", "indexPos": "0", "placeHolder": "NAME THIS CARD (Required)"}, \
                {"value": "Detail Check", "isUpper": "1", "keyName": "FirstName", "indexPos": "2", \
                "placeHolder": "First Name(Required)"}, {"value": "sdfsdfsdfdsf", "isUpper": "1", \
                "keyName": "LastName", "indexPos": "3", "placeHolder": "Last Name"}, \
                {"value": "sdfsdf", "isUpper": "1", "keyName": "NickName", "indexPos": "4", "placeHolder": \
                "Nick Name Or Alias"}, {"value": "asfasf", "isUpper": "1", "keyName": "DEPTName", "indexPos": \
                "5", "placeHolder": "Title & Department"}, {"value": "zvzxvx", "isUpper": "1", "keyName": \
                "CompName", "indexPos": "6", "placeHolder": "Company Name"}], \
                "contact_info": {"email": [{"data": "[email protected]", "type": "home"}, \
                {"data": "*****@*****.**", "type": "work"}, {"data": "*****@*****.**", "type": "iCloud"}], \
                "phone": [{"data": "(122) 222-221", "type": "home", "countryCode": "+93", "countryFlag": "AF"}, \
                {"data": "(yyy) yyy-yyy1", "type": "work", "countryCode": "+93", "countryFlag": "AF"}]}}, \
                "side_second": {"contact_info": {"email": [{"data": "*****@*****.**", "type": "home"}, \
                {"data": "*****@*****.**", "type": "work"}, {"data": "*****@*****.**", "type": "iCloud"}], \
                "phone": [{"data": "sec_12341", "type": "home", "countryCode": "+93", "countryFlag": "AF"}, \
                {"data": "1234123412341", "type": "home", "countryCode": "+93", "countryFlag": "AF"}]}}}'
        }
        auth_headers = {
            'HTTP_AUTHORIZATION': 'Token ' + str(self.user_token)
        }
        response = self.client.post(
            '/api/businesscard/',
            self.business_card_data,
            format='json',
            **auth_headers)
        self.business_card_id = response.data["data"]["id"]

        """ End """
Exemple #2
0
    def setUp(self):
        """ create the user and get the token """
        url = '/api/users/'
        data = {
            "first_name": "sazid",
            "email": "*****@*****.**",
            "password": "******",
            "user_type": 2,
            "status": 1}
        response = self.client.post(url, data, format='json')
        self.user_token = getToken(response.data["data"]["id"])
        """ End """

        """ Get the activation code by using profile Model and call user activity api"""
        profile_obj = Profile.objects.get(user_id=response.data["data"]["id"])
        activation_key = profile_obj.activation_key

        url = '/api/useractivity/?activation_key=%s' % (activation_key)
        response = self.client.get(
            url, {"activation_key": activation_key}, format='json')
        """ End """