Esempio n. 1
0
    def setUp(self):

        self.acc1 = Account.new(first_name='Jack',
                                last_name='Lindon',
                                email='*****@*****.**',
                                passport_number='sh112332')

        self.acc2 = Account.new(first_name='Adam',
                                last_name='Ginger',
                                email='*****@*****.**',
                                passport_number='8845')

        ApprovementBid.objects.create(account=self.acc1,
                                      state=ApprovementState.WaitingForDelete)

        manager = Manager.objects.create(
            username='******',
            email='*****@*****.**',
            password='******',
        )

        self.client = Client()
        self.client.post(reverse('manager_login'), {
            'email': manager.email,
            'password': manager.password
        })
Esempio n. 2
0
    def test_closed_accounts_list(self):
        """
        Test for closed accounts list
        """
        self.acc1 = Account.new(first_name='Jack',
                                last_name='Lindon',
                                email='*****@*****.**',
                                passport_number='sh112332')

        self.acc2 = Account.new(first_name='Adam',
                                last_name='Ginger',
                                email='*****@*****.**',
                                passport_number='8845')

        self.acc3 = Account.new(first_name='test',
                                last_name='Ginger',
                                email='*****@*****.**',
                                passport_number='8527')
        ApprovementBid.objects.create(account=self.acc1,
                                      state=ApprovementState.WaitingForDelete,
                                      processed=datetime.now())
        ApprovementBid.objects.create(account=self.acc2,
                                      state=ApprovementState.WaitingForDelete)

        ApprovementBid.objects.create(
            account=self.acc3,
            state=ApprovementState.WaitingForActivate,
            processed=datetime.now())

        response = self.client.get(reverse('closed_accounts'))
        self.assertEqual(response.status_code, 200)

        self.assertEqual(len(response.data), 1)
Esempio n. 3
0
    def create(self, validated_data):
        account = Account.new(validated_data.get('first_name'),
                              validated_data.get('last_name'),
                              validated_data.get('email'),
                              validated_data.get('passport_number'))

        return dict(first_name=account.first_name,
                    last_name=account.last_name,
                    email=account.email,
                    pin=account.pin)
Esempio n. 4
0
    def test_for_activate_account(self):
        """
        Test for account leave system
        """
        self.acc = Account.new(first_name='Jack',
                               last_name='Lindon',
                               email='*****@*****.**',
                               passport_number='sh112332')

        response = self.client.post(reverse('process_bid', args=[1]))
        self.assertEqual(response.status_code, 200)

        account = Account.objects.first()
        self.assertEqual(account.state, AccountState.Active)

        bid = ApprovementBid.objects.first()
        self.assertIsNotNone(bid.processed)