Esempio n. 1
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Types
        u1 = UserType.objects.create(Name="Type 1")
        u2 = UserType.objects.create(Name="Type 2")
        u3 = UserType.objects.create(Name="Type 3")

        brian = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Brian",
                                    last_name="Katchmar")  # Passes
        settings_brian = UserSettings()
        settings_brian = settings_brian.get_settings_based_on_user(brian)
        settings_brian.BusinessName = "MIAC"
        settings_brian.Region = "New York"
        settings_brian.save()
        UserAssociatedTypes.objects.create(UserAccount=brian,
                                           UserFreelanceType=u1)

        josh = User.objects.create(username="******",
                                   email="*****@*****.**",
                                   first_name="Josh",
                                   last_name="Blank")  # No User Settings

        kenny = User.objects.create(
            username="******",
            email="*****@*****.**",
            first_name="Kenny",
            last_name="Kim"
        )  # Has User Settings, has associated types, neither of the two fields we check
        kenny.set_password("Thing5Ar3Gr34t")
        kenny.save()
        settings_kenny = UserSettings()
        settings_kenny = settings_brian.get_settings_based_on_user(kenny)
        settings_kenny.save()
        UserAssociatedTypes.objects.create(UserAccount=kenny,
                                           UserFreelanceType=u2)
        UserAssociatedTypes.objects.create(UserAccount=kenny,
                                           UserFreelanceType=u3)

        clara = User.objects.create(
            username="******",
            email="*****@*****.**",
            first_name="Clara",
            last_name="Chang")  # Has User Settings, no associated types
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()
        settings_clara = UserSettings()
        settings_clara = settings_brian.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.save()
Esempio n. 2
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        kenny = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Kenny",
                                    last_name="Kim")
        kenny.set_password("Thing5Ar3Gr34t")
        kenny.save()

        clara = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Clara",
                                    last_name="Chang")
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()

        settings_kenny = UserSettings()
        settings_kenny = settings_kenny.get_settings_based_on_user(kenny)
        settings_kenny.save()

        settings_clara = UserSettings()
        settings_clara = settings_clara.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.PhoneNumber = "2125555555"
        settings_clara.StripeConnectAccountKey = "1234567890"
        settings_clara.save()
Esempio n. 3
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Types
        u1 = UserType.objects.create(Name="Clara Type 1")
        u2 = UserType.objects.create(Name="Clara Type 2")
        u3 = UserType.objects.create(Name="Clara Type 3")

        clara = User.objects.create(
            username="******",
            email="*****@*****.**",
            first_name="Clara",
            last_name="Chang")  # Has User Settings, no associated types
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()
        settings_clara = UserSettings()
        settings_clara = settings_clara.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.save()
Esempio n. 4
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Users
        user_1 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_1.set_password("Th3L10nK1ng15Fun")
        user_1.save()
        settings_user_1 = UserSettings()
        settings_user_1 = settings_user_1.get_settings_based_on_user(user_1)
        settings_user_1.BusinessName = "MIAC"
        settings_user_1.Region = "New York"
        settings_user_1.save()

        user_2 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_2.set_password("Thing5Ar3Gr34t")
        user_2.save()
        settings_user_2 = UserSettings()
        settings_user_2 = settings_user_2.get_settings_based_on_user(user_2)
        settings_user_2.save()

        user_3 = User.objects.create(username="******",
                                     email="*****@*****.**",
                                     first_name="Brian",
                                     last_name="Katchmar")
        user_3.set_password("Thing5Ar3Gr34t")
        user_3.save()
        settings_user_3 = UserSettings()
        settings_user_3 = settings_user_3.get_settings_based_on_user(user_3)
        settings_user_3.BusinessName = "InFlow"
        settings_user_3.Region = "New York"
        settings_user_3.PhoneNumber = "2125555555"
        settings_user_3.StripeConnectAccountKey = "1234567890"
        settings_user_3.save()
Esempio n. 5
0
    def post(self, request):
        context = self.get_context_data(request)

        # Gather Data From Post
        business_name = request.POST.get("business-name", "")
        region = request.POST.get("region", "")
        zip_code = request.POST.get("zip-code", "")

        # Build up user settings or fetch previously saved ones, then save what was selected as the freelancer work with and interested in
        usersettings = UserSettings()
        usersettings = usersettings.get_settings_based_on_user(request.user)
        usersettings.BusinessName = business_name
        usersettings.Region = region
        usersettings.ZipCode = zip_code
        usersettings.save()

        return redirect(reverse("base:dashboard"))
Esempio n. 6
0
    def setUp(self):
        # Necessary Currency Objects
        usd = Currency.objects.create()

        USA = Country()
        USA.PrimaryCurrency = usd
        USA.Name = "United States"
        USA.Code = "US"
        USA.save()

        # Users
        brian = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Brian",
                                    last_name="Katchmar")
        brian.set_password("Th3L10nK1ng15Fun")
        brian.save()
        settings_brian = UserSettings()
        settings_brian = settings_brian.get_settings_based_on_user(brian)
        settings_brian.BusinessName = "MIAC"
        settings_brian.Region = "New York"
        settings_brian.save()

        kenny = User.objects.create(
            username="******",
            email="*****@*****.**",
            first_name="Kenny",
            last_name="Kim"
        )  # Has User Settings, has associated types, neither of the two fields we check
        kenny.set_password("Thing5Ar3Gr34t")
        kenny.save()
        settings_kenny = UserSettings()
        settings_kenny = settings_kenny.get_settings_based_on_user(kenny)
        settings_kenny.save()

        clara = User.objects.create(username="******",
                                    email="*****@*****.**",
                                    first_name="Clara",
                                    last_name="Chang")
        clara.set_password("Thing5Ar3Gr34t")
        clara.save()
        settings_clara = UserSettings()
        settings_clara = settings_clara.get_settings_based_on_user(clara)
        settings_clara.BusinessName = "InFlow"
        settings_clara.Region = "New York"
        settings_clara.PhoneNumber = "2125555555"
        settings_clara.StripeConnectAccountKey = "1234567890"
        settings_clara.save()

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_1).exists():
            ns1 = NotificationSetting.objects.get(
                SettingName=self.setting_string_1)
        else:
            ns1 = NotificationSetting.objects.create(
                SettingName=self.setting_string_1)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_2).exists():
            ns2 = NotificationSetting.objects.get(
                SettingName=self.setting_string_2)
        else:
            ns2 = NotificationSetting.objects.create(
                SettingName=self.setting_string_2)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_3).exists():
            ns3 = NotificationSetting.objects.get(
                SettingName=self.setting_string_3)
        else:
            ns3 = NotificationSetting.objects.create(
                SettingName=self.setting_string_3)

        if NotificationSetting.objects.filter(
                SettingName=self.setting_string_4).exists():
            ns4 = NotificationSetting.objects.get(
                SettingName=self.setting_string_4)
        else:
            ns4 = NotificationSetting.objects.create(
                SettingName=self.setting_string_4)

        # Purge the DB Entries, we're rebuild what we're expecting
        UserNotificationSettings.objects.filter(UserAccount=brian).delete()
        UserNotificationSettings.objects.filter(UserAccount=kenny).delete()
        UserNotificationSettings.objects.filter(UserAccount=clara).delete()

        # Brian
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns1,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns2,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns3,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=brian,
                                                Setting=ns4,
                                                Selected=True)

        # Kenny
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns1,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns2,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns3,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=kenny,
                                                Setting=ns4,
                                                Selected=True)

        # Clara
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns1,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns2,
                                                Selected=True)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns3,
                                                Selected=False)
        UserNotificationSettings.objects.create(UserAccount=clara,
                                                Setting=ns4,
                                                Selected=True)