def test_list_sellers(self):
        """
        Test list_sellers method.
        """
        self.set_get_mock(200, {"items": [IndividualSellerFactory()]})

        response = self.client.list_sellers()
        self.assertEqual(response.status_code, 200, msg=response.data)
        items = response.data.get("items")
        self.assertTrue(items)
    def test_search_individual_seller(self):
        """
        Test search_individual_seller method.
        """
        self.set_get_mock(200, IndividualSellerFactory(id="foo").to_dict())

        response = self.client.search_individual_seller("bar")
        self.assertEqual(response.status_code, 200, msg=response.data)
        self.assertEqual(response.data.get("id"), "foo")
        self.assertIsInstance(response.instance, Seller)
        self.assertEqual(response.instance.id, "foo")
예제 #3
0
    def test_add_bank_account(self, mocked_add_token):
        """
        Test add_bank_account method.
        """
        mocked_add_token.return_value = MagicMock(
            instance=BankAccountTokenFactory(allow_empty=True)
        )

        self.set_post_mock(200, IndividualBankAccountFactory(id="foo").to_dict())

        self.set_get_mock(200, IndividualSellerFactory(id="foo").to_dict())

        data = CreateIndividualBankAccountTokenFactory().to_dict()

        response = self.client.add_bank_account(data)
        self.assertEqual(response.status_code, 200, msg=response.data)
예제 #4
0
    def test_get_validation_fields_individual(self):
        instance = IndividualSellerFactory()
        self.assertIsInstance(instance, Seller)

        self.assertIsSubSet(set(), instance.get_validation_fields())
예제 #5
0
    def test_get_all_fields_individual(self):
        instance = IndividualSellerFactory()
        self.assertIsInstance(instance, Seller)

        self.assertIsSubSet({"website"}, instance.get_all_fields())
예제 #6
0
    def test_create_individual(self):
        instance = IndividualSellerFactory()

        self.assertIsInstance(instance, Seller)